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.

Author eryksun
Recipients ZackerySpytz, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-06-08.04:20:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1591590041.93.0.319493615556.issue40882@roundup.psfhosted.org>
In-reply-to
Content
Thanks for working on the PR, Zackery. Would you be interested in working on improvements to mmap for 3.10? With support in mmap, the Windows-specific initialization of SharedMemory could be as simple as the following:

    # Windows Named Shared Memory

    while True:
        tagname = _make_filename() if name is None else name
        try:
            self._mmap = mmap.mmap(-1, size if create else 0,
                tagname, create=create)
            break
        except FileExistsError:
            if name is not None:
                raise

    self._name = tagname
    self._size = len(self._mmap)

The new mmap `create` parameter would default to None, which uses the current behavior that allows either opening or creating a file mapping with no sanity checking (e.g. a valid fd gets passed in, but it opens an unrelated file mapping via tagname). If `create` is true, and there's an existing file mapping named `tagname`, then raise FileExistsError. If `create` is false, call OpenFileMappingW instead of CreateFileMappingW. In this case, `fileno` must be -1, `length` is allowed to be 0, and `tagname` must be a non-empty string. If `length` is 0, map the entire file mapping and get the size via VirtualQuery: RegionSize.
History
Date User Action Args
2020-06-08 04:20:41eryksunsetrecipients: + eryksun, paul.moore, tim.golden, zach.ware, steve.dower, ZackerySpytz
2020-06-08 04:20:41eryksunsetmessageid: <1591590041.93.0.319493615556.issue40882@roundup.psfhosted.org>
2020-06-08 04:20:41eryksunlinkissue40882 messages
2020-06-08 04:20:41eryksuncreate