Message370955
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. |
|
Date |
User |
Action |
Args |
2020-06-08 04:20:41 | eryksun | set | recipients:
+ eryksun, paul.moore, tim.golden, zach.ware, steve.dower, ZackerySpytz |
2020-06-08 04:20:41 | eryksun | set | messageid: <1591590041.93.0.319493615556.issue40882@roundup.psfhosted.org> |
2020-06-08 04:20:41 | eryksun | link | issue40882 messages |
2020-06-08 04:20:41 | eryksun | create | |
|