FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-155003: Don't try to close mmap in SharedMemory.__del__ by takluyver · Pull Request #155070 · python/cpython · GitHub

Repository navigation

gh-155003: Don't try to close mmap in SharedMemory.__del__ - #155070

Open
takluyver wants to merge 1 commit into
python:mainfrom
takluyver:fix-issue-155003-b
Open

takluyver wants to merge 1 commit into
python:mainfrom
takluyver:fix-issue-155003-b

Conversation

takluyver commented Aug 2, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor

This is an alternative to #155007, keeping the file descriptor in the object and fixing the __del__ method to close it without trying to close the mmap or memoryview, which was my original idea in #155003.

I could add, in this PR or separately:

  • The same posix_fallocate() change as in gh-155003: Don't keep file descriptor in multiprocessing SharedMemory object #155007 - but with this option it's orthogonal.
  • A public API to access the fd, probably a .fileno() method, which is a convention for higher level objects which wrap an fd.
  • Use mmap(..., trackfd=False) to skip the duplicate fd within mmap (at a cost of breaking potential workarounds using sm._mmap.resize() & .size())

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL