[issue15944] memoryviews and ctypes
Martin Panter
report at bugs.python.org
Thu Aug 6 02:44:05 CEST 2015
Martin Panter added the comment:
In my experience, I tend to only use memoryview() for “bytes-like” buffers (but see Issue 23756 about clarifying what this means). Example from /Lib/_compression.py:67:
def readinto(self, b):
with memoryview(b) as view, view.cast("B") as byte_view:
data = self.read(len(byte_view))
byte_view[:len(data)] = data
return len(data)
Fixing cast("B") or adding a memoryview(raw=True) mode could probably help when all you want is a byte buffer.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15944>
_______________________________________
More information about the Python-bugs-list
mailing list