Martin Panter added the comment:
I would say that the current patch looks correct enough, in that it would still
get the correct lengths when a memoryview() object is passed in. The zlib
module’s crc32() function and compress() method already seem to support
arbitrary bytes-like objects.
But to make GzipFile.write() also accept arbitrary bytes-like objects, you
probably only need to change the code calculating the length to something like:
with memoryview(data) as view:
length = view.nbytes
# Go on to call compress(data) and crc32(data)
----------
nosy: +vadmium
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue23688>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com