Serhiy Storchaka added the comment:

You patch is correct Wolfgang, but with cast('B') the patch would be smaller 
(no need to replace len(data) to nbytes).

While we are here, it is possible to add the support of general byte-like 
objects.

if not isinstance(data, bytes):
    data = memoryview(data).cast('B')

isinstance() check is just for optimization, it can be omitted if doesn't 
affect a performance.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23688>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to