Eryk Sun <[email protected]> added the comment:
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.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40882>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com