[issue23688] unnecessary copying of memoryview in gzip.GzipFile.write ?

Serhiy Storchaka report at bugs.python.org
Tue Mar 17 17:05:29 CET 2015


Serhiy Storchaka added the comment:

memoryview is converted to bytes because len() for memoryview returns a size of first dimension (a number of items for one-dimension view), not a number of bytes.

>>> m = memoryview(array.array('I', [1, 2, 3]))
>>> len(m)
3
>>> len(m.tobytes())
12
>>> len(m.cast('B'))
12

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23688>
_______________________________________


More information about the Python-bugs-list mailing list