[issue8042] mmap buffer implementation does not respect seek pos

Antoine Pitrou report at bugs.python.org
Mon Aug 2 18:49:43 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

If you want to slice into a writable buffer, you can use a memoryview:

>>> b = io.BytesIO(b"abc")
>>> m = mmap.mmap(-1, 10)
>>> b.readinto(memoryview(m)[5:])
3
>>> m[:]
b'\x00\x00\x00\x00\x00abc\x00\x00'

This only works on 3.x, though.
As for changing the mmap buffer implementation, it would break compatibility and is therefore not acceptable, sorry.

----------
nosy: +georg.brandl
resolution:  -> rejected
status: open -> closed

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


More information about the Python-bugs-list mailing list