[issue17839] base64 module should use memoryview

2013-11-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset e53984133740 by Nick Coghlan in branch 'default': Issue #17839: mention base64 change in What's New http://hg.python.org/cpython/rev/e53984133740 -- ___ Python tracker

[issue17839] base64 module should use memoryview

2013-10-02 Thread Roundup Robot
Roundup Robot added the comment: New changeset d90f25e1a705 by Nick Coghlan in branch 'default': Close #17839: support bytes-like objects in base64 module http://hg.python.org/cpython/rev/d90f25e1a705 -- nosy: +python-dev resolution: -> fixed stage: patch review -> committed/rejected st

[issue17839] base64 module should use memoryview

2013-10-02 Thread Nick Coghlan
Nick Coghlan added the comment: After working through this, I found that the modern base64 API just relies on the checks in binascii. All that checks for is: 1. Can the data by exported using PyBUF_SIMPLE? 2. Is it C contiguous? It completely ignores the number of dimensions and the format inf

[issue17839] base64 module should use memoryview

2013-10-02 Thread Nick Coghlan
Nick Coghlan added the comment: However, _input_type_check should enforce that (as binascii does), so I'll add that before committing. -- assignee: -> ncoghlan ___ Python tracker _

[issue17839] base64 module should use memoryview

2013-10-02 Thread Nick Coghlan
Nick Coghlan added the comment: binascii already only supports simple C contiguous buffers, expanding it and the base64 module to handle anything else should be a separate RFE. -- dependencies: -Allow memoryview.cast() for empty views ___ Python tra

[issue17839] base64 module should use memoryview

2013-10-01 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- dependencies: +Allow memoryview.cast() for empty views ___ Python tracker ___ ___ Python-bugs-list ma

[issue17839] base64 module should use memoryview

2013-05-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It works only if input also supports slicing and this slicing is corresponded to bytes-slicing. It perhaps doesn't catch a non C-continuous buffers. Actually we need something like (unlikely cast() doesn't work with empty buffers): s = memoryview(s)

[issue17839] base64 module should use memoryview

2013-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: Just adding a note for easier cross-referencing: the old behaviour of these functions was one of the culprits that led to the removal of the codec aliases as discussed in issue 7475 -- ___ Python tracker

[issue17839] base64 module should use memoryview

2013-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: The codec uses the old API that breaks the encoded output up into multiple lines. The new patch: 1. Also changes the behaviour of the older de/encodebytes API 2. Checks that all the defined binary transform codecs actually support memoryview as input for both e

[issue17839] base64 module should use memoryview

2013-05-23 Thread Nick Coghlan
Nick Coghlan added the comment: We now also need to update the new footnote that I added for issue 17844 in http://hg.python.org/cpython/rev/801567d6302c -- ___ Python tracker _

[issue17839] base64 module should use memoryview

2013-05-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you Ezio and Nick for your comments. > I suggest renaming _bytes_from_decode_data to "_bytes_for_decoding" and > adding "_bytes_for_encoding". I rather think a TypeError exception raised by `memoryview(s).tobytes()` is good enough and we don't need a

[issue17839] base64 module should use memoryview

2013-05-19 Thread Nick Coghlan
Nick Coghlan added the comment: Oops, my review comments don't actually make sense because I looked at the patch in isolation, rather than checking the full context in the module. Sorry about that. We have 2 different cases to deal with, only one of which currently has a helper function. I s

[issue17839] base64 module should use memoryview

2013-05-18 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Nick, what you say about the patch? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue17839] base64 module should use memoryview

2013-04-29 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue17839] base64 module should use memoryview

2013-04-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Here is a patch which allows bytes-like arguments in the base64 module. I just removed type checking if underlying function raises an exception with an appropriate message. I'm not sure about b32encode(), perhaps we can left an exception from memoryview().

[issue17839] base64 module should use memoryview

2013-04-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Note that some functions use bytes/bytearray methods and an argument should converted to bytes for them. Other functions use C functions which supports the buffer protocol and do not required any conversion. -- __

[issue17839] base64 module should use memoryview

2013-04-27 Thread Nick Coghlan
Nick Coghlan added the comment: As Serhiy and Antoine noted, what I had in mind here was to try to wrap the input in a memoryview if it wasn't an instance of str, bytes or bytearray. An existing memoryview will be passed back unmodified, while something like array.array will provide a view int

[issue17839] base64 module should use memoryview

2013-04-27 Thread Antoine Pitrou
Antoine Pitrou added the comment: Yes, this should probably be done the other way around: wrap the base64 argument in a memoryview, and encode/decode from it. -- nosy: +pitrou ___ Python tracker __

[issue17839] base64 module should use memoryview

2013-04-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Not only memoryview should be supported, but any class which supports the buffer protocol and is C-contiguous (i.e. array.array). -- nosy: +serhiy.storchaka ___ Python tracker _

[issue17839] base64 module should use memoryview

2013-04-26 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti stage: needs patch -> patch review ___ Python tracker ___ ___ Python-bugs-list mailin

[issue17839] base64 module should use memoryview

2013-04-26 Thread Kushal Das
Kushal Das added the comment: A patch with tests update to use memoryview in base64 module. -- keywords: +patch Added file: http://bugs.python.org/file30022/issue17839_v1.patch ___ Python tracker __

[issue17839] base64 module should use memoryview

2013-04-25 Thread Barry A. Warsaw
Changes by Barry A. Warsaw : -- nosy: +barry ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue17839] base64 module should use memoryview

2013-04-25 Thread Kushal Das
Kushal Das added the comment: Working on this. -- nosy: +kushaldas ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscrib

[issue17839] base64 module should use memoryview

2013-04-25 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- dependencies: +Add base64 module tests for a bytearray argument ___ Python tracker ___ ___ Python-bug

[issue17839] base64 module should use memoryview

2013-04-25 Thread Nick Coghlan
New submission from Nick Coghlan: The base64 module is currently restricted specifically to bytes and bytearray objects. By using memoryview, it could effectively decode any input type that provides an 8-bit C contiguous view of the underlying data. -- components: Library (Lib) message