This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: mmap buffer implementation does not respect seek pos
Type: Stage:
Components: Versions: Python 2.6
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: pitrou Nosy List: Matt.Gattis, georg.brandl, pitrou
Priority: normal Keywords:

Created on 2010-03-02 21:26 by Matt.Gattis, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg100308 - (view) Author: Matt Gattis (Matt.Gattis) Date: 2010-03-02 21:26
If you do:

import io,mmap

b = io.BytesIO("abc")
m = mmap.mmap(-1,10)

M is now:

Basically there is no way to readinto/recv_into an arbitary position in an mmap object without creating a middle-man string.
msg112499 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-08-02 16:49
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:])
>>> m[:]

This only works on 3.x, though.
As for changing the mmap buffer implementation, it would break compatibility and is therefore not acceptable, sorry.
Date User Action Args
2022-04-11 14:56:58adminsetgithub: 52290
2010-08-02 16:49:42pitrousetstatus: open -> closed

nosy: + georg.brandl
messages: + msg112499

resolution: rejected
2010-08-01 22:55:16georg.brandlsetassignee: pitrou

nosy: + pitrou
2010-03-02 21:26:04Matt.Gattiscreate