Message238376
| Author | martin.panter |
|---|---|
| Recipients | martin.panter, serhiy.storchaka, vstinner, wolma |
| Date | 2015-03-18.04:36:54 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1426653415.04.0.0486094319733.issue23688@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
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) |
|
| History | |||
|---|---|---|---|
| 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 | |