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-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
vstinner merged 8 commits intopython:mainfromvstinner:union_getitem
Apr 23, 2025
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
Use FT_ATOMIC to load/store the pointer
  • Loading branch information
@vstinner
vstinner committedApr 22, 2025
commita7b74a36b9a339d11bd103aa94e963234aec5a5c
5 changes: 3 additions & 2 deletionsObjects/unionobject.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -327,7 +327,7 @@ static int
union_init_parameters(unionobject *alias)
{
// Avoid the critical section if it's already initialized.
if (alias->parameters != NULL) {
if (FT_ATOMIC_LOAD_PTR_RELAXED(alias->parameters) != NULL) {
return 0;
}

Expand All@@ -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) {
alias->parameters = _Py_make_parameters(alias->args);
FT_ATOMIC_STORE_PTR(alias->parameters,
_Py_make_parameters(alias->args));
if (alias->parameters == NULL) {
result = -1;
}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp