Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-132713: Fix typing.Union[index] race condition#132802
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
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes from1 commit
Commits
Show all changes
8 commits Select commitHold shift + click to select a range
208f247 gh-132713: Fix typing.Union[index] race condition
vstinnerd81ec9b Add comment
vstinnerd93396a Add comment about the micro-optimization
vstinnerf12f905 Fix also union_parameters()
vstinnera7b74a3 Use FT_ATOMIC to load/store the pointer
vstinner27da04d Remove the optimization
vstinner26c9a32 Remove empty line
vstinner8eb3cbd Merge branch 'main' into union_getitem
vstinnerFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
Use FT_ATOMIC to load/store the pointer
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
commita7b74a36b9a339d11bd103aa94e963234aec5a5c
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -327,7 +327,7 @@ static int | ||
| union_init_parameters(unionobject *alias) | ||
| { | ||
| // Avoid the critical section if it's already initialized. | ||
| if (FT_ATOMIC_LOAD_PTR_RELAXED(alias->parameters) != NULL) { | ||
| return 0; | ||
| } | ||
| @@ -336,7 +336,8 @@ union_init_parameters(unionobject *alias) | ||
| // Need to check again once we got the lock, another thread may have | ||
| // initialized it while we were waiting for the lock. | ||
| if (alias->parameters == NULL) { | ||
| FT_ATOMIC_STORE_PTR(alias->parameters, | ||
| _Py_make_parameters(alias->args)); | ||
| if (alias->parameters == NULL) { | ||
vstinner marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| result = -1; | ||
| } | ||
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.