[Python-ideas] Adding shm_open to mmap?

Antoine Pitrou solipsis at pitrou.net
Wed Feb 15 01:05:18 CET 2012

On Tue, 14 Feb 2012 18:50:44 -0500
Mike Meyer <mwm at mired.org> wrote:
> This seems like a slam-dunk to me, but...
> 1) Is there some reason not to just add these two functions?
> 2) Are there any supported platforms with mmap and without
>    shm_open/unlink?
> 3) Is this simple enough that a PEP isn't needed, just a patch in an
>    issue?

A patch is enough.

Note that this functionality is already available under Windows
(though not really advertised in our docs), through the `tagname`
parameter to mmap.mmap():

>>> import mmap
>>> f = mmap.mmap(-1, 4096, "mysharedmem")
>>> f.write(b"some bytes")

And in another session:

>>> import mmap
>>> f = mmap.mmap(-1, 4096, "mysharedmem")
>>> f.read(10)
b'some bytes'

See http://docs.python.org/dev/library/mmap.html and



More information about the Python-ideas mailing list