Message238376
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) |
|
Date |
User |
Action |
Args |
2015-03-18 04:36:55 | martin.panter | set | recipients:
+ martin.panter, vstinner, serhiy.storchaka, wolma |
2015-03-18 04:36:55 | martin.panter | set | messageid: <1426653415.04.0.0486094319733.issue23688@psf.upfronthosting.co.za> |
2015-03-18 04:36:55 | martin.panter | link | issue23688 messages |
2015-03-18 04:36:54 | martin.panter | create | |
|