Uh oh!
There was an error while loading. Please reload this page.
gh-116738: Make mmap module thread-safe - #139237
Conversation
ZeroIntensity
left a comment
There was a problem hiding this comment.
I think that it would be helpful in the long run to switch mmap to AC rather than manually adding lock_held functions everywhere.
Uh oh!
There was an error while loading. Please reload this page.
corona10
commented
Sep 23, 2025
Same question from my side: |
yoney
commented
Sep 24, 2025
@ZeroIntensity, @corona10: Thank you both for the reviews, I agree that using AC with I wanted to ask for your preference: would you like to implement the switch in this PR, or should I hold off on this one and do the implementation separately, then continue with this PR after that? Alternatively, the switch could be done as a follow-up PR. Thanks! |
ZeroIntensity
commented
Sep 24, 2025
Let's do AC in this PR. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
vstinner
left a comment
There was a problem hiding this comment.
LGTM. I reviewed mmapmodule.c, but I didn't review Lib/test/test_free_threading/test_mmap.py.
bedevere-bot
commented
Oct 8, 2025
🤖 New build scheduled with the buildbot fleet by @kumaraditya303 for commit 9d6b95d 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F139237%2Fmerge If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again. |
Uh oh!
There was an error while loading. Please reload this page.
Thanks @yoney for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, @yoney and @kumaraditya303, I could not cleanly backport this to |
(cherry picked from commit 7f155f9) Co-authored-by: Alper <alperyoney@fb.com>
GH-139825 is a backport of this pull request to the 3.14 branch. |
bedevere-bot
commented
Oct 9, 2025
|
…) (python#139825) * [3.14] pythongh-116738: make `mmap` module thread-safe (pythonGH-139237) (cherry picked from commit 7f155f9) Co-authored-by: Alper <alperyoney@fb.com>
These changes make the
mmapmodule thread-safe for FT-Python by protecting themmap_objectagainst race conditions and undefined behavior. The goal is to provide behavior similar to standard Python builds with the GIL enabled, rather than makingmmapfully deterministic or generally recommended for multithreaded use.cc: @mpage@colesbury@Yhg1s