[issue17839] base64 module should use memoryview

Serhiy Storchaka report at bugs.python.org
Fri May 24 09:01:59 CEST 2013


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)
    if not s:
        return b''
    s = s.cast('B')
    ...

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17839>
_______________________________________


More information about the Python-bugs-list mailing list