-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-119247: Add macros to use PySequence_Fast safely in free-threaded build #119315
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @MojoVampire - this looks good. I left some comments below.
I've edited the PR title and comment a bit. Feel free to edit them further, if you would like. |
@colesbury: I think I've addressed everything. Thanks for the quick review! |
4611857
to
87d894d
Compare
87d894d
to
796cfd9
Compare
… test for regressions
…sts segfault or die with assertion failures >95% of the time without locking macro, pass reliably with locking macro
Use braces to restrict scope of conditional locking Co-authored-by: Sam Gross <[email protected]>
Co-authored-by: Sam Gross <[email protected]>
Co-authored-by: Sam Gross <[email protected]>
… total time to run tests (both tests combine to less than 200 ms in debug build on my laptop)
…section include Python.h which provides listobject.h)
…onize, and perform multiple joins per loop to increase chance of repro without synchronization
796cfd9
to
254a5a5
Compare
@DinoV & @colesbury: What needs to happen to perform the final merge? I rebased a few minutes ago to be sure it was fully up-to-date with main, not really sure what the next step is now that it's been reviewed. |
I'll merge it after the CI passes |
Thanks @MojoVampire for the PR, and @colesbury for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…eaded build (pythonGH-119315) Add `Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST` and `Py_END_CRITICAL_SECTION_SEQUENCE_FAST` macros and update `str.join` to use them. Also add a regression test that would crash reliably without this patch. (cherry picked from commit baf347d) Co-authored-by: Josh {*()} Rosenberg <[email protected]>
GH-119419 is a backport of this pull request to the 3.13 branch. |
…readed build (GH-119315) (#119419) Add `Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST` and `Py_END_CRITICAL_SECTION_SEQUENCE_FAST` macros and update `str.join` to use them. Also add a regression test that would crash reliably without this patch. (cherry picked from commit baf347d) Co-authored-by: Josh {*()} Rosenberg <[email protected]>
@MojoVampire Thanks for the PR, the I am trying to use it to make |
Found it! Works, but one has to take care of goto statements in the code that can jump beyond the |
…eaded build (python#119315) Add `Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST` and `Py_END_CRITICAL_SECTION_SEQUENCE_FAST` macros and update `str.join` to use them. Also add a regression test that would crash reliably without this patch.
Add
Py_BEGIN_CRITICAL_SECTION_SEQUENCE_FAST
andPy_END_CRITICAL_SECTION_SEQUENCE_FAST
macros and updatestr.join
to use them. Also add a regression test that would crash reliably without this patch.