-
-
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-111956: Add thread-safe one-time initialization. #111960
Conversation
The one-time initialization (`_PyOnceFlag`) is used in two places: * `Python/Python-ast.c` * `Python/getargs.c`
@ericsnowcurrently, when you have some time, would you please look at this? One question: I'm unsure of what |
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.
Aside from one small thing, LGTM.
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 |
The typical convention in the case of success vs. error is -1 for error and 0 for success. The 0/1 convention is more for true/false situations. |
@ericsnowcurrently that makes sense. I'll change it to -1=error, 0=success. |
@ericsnowcurrently, I changed the code to use |
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
FWIW, I haven't combed through the asdl_c.py changes but would expect the test suite to catch any mistakes in there. It's also a good sign that you caught the bug in init_identifiers()
. 😄
I'll merge this in the morning if no one beats me to it. |
The one-time initialization (
_PyOnceFlag
) is used in two places:Python/Python-ast.c
Python/getargs.c