Issue 4885: mmap enhancement request (original) (raw)

Created on 2009-01-08 20:18 by ndbecker, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue-4885.patch lambertv,2013-08-02 05:55 review
Messages (9)
msg79433 - (view) Author: (ndbecker) Date: 2009-01-08 20:18
I'd like to suggest some improvements from mmap 1) mmap assign to slice only accepts a string. This is unfortunate, because AFAIK a string can only be created by copying data, and this is wasteful for large data transfers. mmap should accept any object supporting buffer protocol as well as string. 2) buffer (mmap_obj) gives a read_only buffer. There should be a way to make this read_write. I suggest 'as_buffer' member. 3) mmap_obj does not support weak ref. This is needed for proper lifetime management using boost::python
msg79435 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-01-08 20:40
As for 2), the buffer() function is deprecated and is replaced in 3.0 by new object called memoryview() (together with a revamped internal API for taking and releasing buffers).
msg192658 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-08 15:18
1) and 2) have been fixed in Python 3.x. mmap supports writable memory views and slice assignment from any object that supports the buffer protocol. 3) is still an issue as mmap objects are not weakref-able yet. It should be easy to add __weakref__ to mmap objects.
msg192659 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2013-07-08 15:20
It's a trivial task for any Python developer with some C experience.
msg194156 - (view) Author: Valerie Lambert (lambertv) * Date: 2013-08-02 05:55
I've uploaded a patch to make mmap_obj support weakref. A test is included in the patch.
msg194176 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-08-02 14:33
Thanks Valerie. I've tested your patch and it looks good to me. Have you signed and sent a contributor's agreement? http://www.python.org/psf/contrib/
msg194215 - (view) Author: Valerie Lambert (lambertv) * Date: 2013-08-02 22:25
I just signed and sent the agreement electronically. Let me know if there is anything else I need to do.
msg194509 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-08-05 21:17
New changeset 1754b7900da1 by Antoine Pitrou in branch 'default': Issue #4885: Add weakref support to mmap objects. Patch by Valerie Lambert. http://hg.python.org/cpython/rev/1754b7900da1
msg194510 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-08-05 21:18
Your patch is now committed. Thanks for contributing!
History
Date User Action Args
2022-04-11 14:56:43 admin set github: 49135
2013-08-05 21🔞13 pitrou set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2013-08-05 21:17:43 python-dev set nosy: + python-devmessages: +
2013-08-02 22:25:41 lambertv set messages: +
2013-08-02 14:33:55 pitrou set messages: +
2013-08-02 12:49:29 pitrou set stage: needs patch -> patch review
2013-08-02 05:55:55 lambertv set files: + issue-4885.patchnosy: + lambertvmessages: + keywords: + patch
2013-07-08 15:20:37 christian.heimes set keywords: + easymessages: +
2013-07-08 15🔞12 christian.heimes set priority: normal -> lowcomponents: + Extension Modules, - Library (Lib)versions: + Python 3.4, - Python 3.2nosy: + christian.heimesmessages: + stage: test needed -> needs patch
2010-08-09 03:13:05 terry.reedy set stage: test neededversions: + Python 3.2, - Python 3.1, Python 2.7
2009-01-08 20:40:11 pitrou set priority: normalnosy: + pitroumessages: + versions: + Python 3.1, Python 2.7, - Python 2.5
2009-01-08 20🔞12 ndbecker create