Visitar URL original
gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters by ericsnowcurrently · Pull Request #119331 · python/cpython · GitHub
Skip to content
Merged
Changes from 1 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
Prev Previous commit
Next Next commit
Fix a no-gil bug in _parser_init().
  • Loading branch information
ericsnowcurrently committed May 21, 2024
commit 35abdad2e446f87600e415cd82af26edbf7d855f
5 changes: 3 additions & 2 deletions Python/getargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1971,8 +1971,8 @@ _parser_init(void *arg)
parser->next = _Py_atomic_load_ptr(&_PyRuntime.getargs.static_parsers);
do {
// compare-exchange updates parser->next on failure
} while (_Py_atomic_compare_exchange_ptr(&_PyRuntime.getargs.static_parsers,
&parser->next, parser));
} while (!_Py_atomic_compare_exchange_ptr(&_PyRuntime.getargs.static_parsers,
Comment thread
1st1 marked this conversation as resolved.
&parser->next, parser));
return 0;
}

Expand Down Expand Up @@ -2885,6 +2885,7 @@ _PyArg_Fini(void)
struct _PyArg_Parser *tmp, *s = _PyRuntime.getargs.static_parsers;
while (s) {
tmp = s->next;
//assert(tmp != s);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//assert(tmp != s);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

s->next = NULL;
parser_clear(s);
s = tmp;
Expand Down