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 <rep...@bugs.python.org>
<http://bugs.python.org/issue17839>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to