Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-111956: Add thread-safe one-time initialization.#111960

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ericsnowcurrently merged 4 commits intopython:mainfromcolesbury:once
Nov 16, 2023

Conversation

@colesbury
Copy link
Contributor

@colesburycolesbury commentedNov 10, 2023
edited by bedevere-appbot
Loading

The one-time initialization (_PyOnceFlag) is used in two places:

  • Python/Python-ast.c
  • Python/getargs.c

The one-time initialization (`_PyOnceFlag`) is used in two places: * `Python/Python-ast.c` * `Python/getargs.c`
@colesbury
Copy link
ContributorAuthor

@ericsnowcurrently, when you have some time, would you please look at this?

One question: I'm unsure of whatint value should be used here to indicate an error or success. I have gone with0=error and1=success here because that requires fewer modifications to the use sites, which already use that convention. I am unsure if-1=error,0=success would be better.

ericsnowcurrently reacted with thumbs up emoji

Copy link
Member

@ericsnowcurrentlyericsnowcurrently left a 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.

@bedevere-app
Copy link

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 phraseI have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ericsnowcurrently
Copy link
Member

I'm unsure of what int value should be used here to indicate an error or success. I have gone with 0=error and 1=success here because that requires fewer modifications to the use sites, which already use that convention. I am unsure if -1=error, 0=success would be better.

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.

@colesbury
Copy link
ContributorAuthor

@ericsnowcurrently that makes sense. I'll change it to -1=error, 0=success.

ericsnowcurrently reacted with thumbs up emoji

@colesbury
Copy link
ContributorAuthor

@ericsnowcurrently, I changed the code to use-1=error0=success and updatedasdl_c.py/Python-ast.c. It ended up being a large change to that file, but fixed one bug where we ignored errors ininit_identifiers due to a mismatch in return code assumptions.

Copy link
Member

@ericsnowcurrentlyericsnowcurrently left a comment
edited
Loading

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 ininit_identifiers(). 😄

colesbury reacted with thumbs up emoji
@ericsnowcurrently
Copy link
Member

I'll merge this in the morning if no one beats me to it.

colesbury reacted with thumbs up emoji

@ericsnowcurrentlyericsnowcurrently merged commit446f18a intopython:mainNov 16, 2023
@colesburycolesbury deleted the once branchDecember 12, 2023 19:38
aisk pushed a commit to aisk/cpython that referenced this pull requestFeb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull requestSep 2, 2024
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ericsnowcurrentlyericsnowcurrentlyericsnowcurrently approved these changes

@isidenticalisidenticalAwaiting requested review from isidentical

Assignees

No one assigned

Labels

3.13bugs and security fixestopic-free-threading

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@colesbury@ericsnowcurrently

[8]ページ先頭

©2009-2025 Movatter.jp