-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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-112071: Make _random.Random
methods thread-safe in --disable-gil
builds
#112128
gh-112071: Make _random.Random
methods thread-safe in --disable-gil
builds
#112128
Conversation
…ble-gil` builds Guard `_random.Random` methods with critical section API locks by using `@critical_section` AC directive
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 @chgnrdv, this LGTM.
@rhettinger, would you be able to review this? This adds @critical_section
Argument Clinic directives to the methods of _random.Random
. In --disable-gil
builds, this acquires/releases the per-object locks around the methods. They are no-ops in the default build.
Modules/_randommodule.c
Outdated
@@ -71,6 +71,7 @@ | |||
#endif | |||
|
|||
#include "Python.h" | |||
#include "pycore_critical_section.h" |
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.
You don't need to add this header manually since the AC automatically adds it.
Please rebase the branch and rerun the make clinic
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be put in the comfy chair! |
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.
LGTM (with my own push) cc @colesbury
…ble-gil` builds (pythongh-112128) Co-authored-by: Donghee Na <donghee.na@python.org>
…ble-gil` builds (pythongh-112128) Co-authored-by: Donghee Na <donghee.na@python.org>
Guard
_random.Random
methods with critical section API locks by using@critical_section
AC directive.Fixes #112071
random.Random
thread-safe in--disable-gil
builds #112071