diff options
author | Sam Gross <colesbury@gmail.com> | 2024-03-29 17:35:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-29 17:35:43 (GMT) |
commit | 19c1dd60c5b53fb0533610ad139ef591294f26e8 (patch) | |
tree | f76436f1512efe26885b65c49585a761a1658e82 /Tools/cases_generator | |
parent | 397d88db5e9ab2a43de3fdf5f8b973a949edc405 (diff) | |
download | cpython-19c1dd60c5b53fb0533610ad139ef591294f26e8.zip cpython-19c1dd60c5b53fb0533610ad139ef591294f26e8.tar.gz cpython-19c1dd60c5b53fb0533610ad139ef591294f26e8.tar.bz2 |
gh-117323: Make `cell` thread-safe in free-threaded builds (#117330)
Use critical sections to lock around accesses to cell contents. The critical sections are no-ops in the default (with GIL) build.
Diffstat (limited to 'Tools/cases_generator')
-rw-r--r-- | Tools/cases_generator/analyzer.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Tools/cases_generator/analyzer.py b/Tools/cases_generator/analyzer.py index 2329205..ddafcf9 100644 --- a/Tools/cases_generator/analyzer.py +++ b/Tools/cases_generator/analyzer.py @@ -520,8 +520,9 @@ def effect_depends_on_oparg_1(op: parser.InstDef) -> bool: def compute_properties(op: parser.InstDef) -> Properties: has_free = ( variable_used(op, "PyCell_New") - or variable_used(op, "PyCell_GET") - or variable_used(op, "PyCell_SET") + or variable_used(op, "PyCell_GetRef") + or variable_used(op, "PyCell_SetTakeRef") + or variable_used(op, "PyCell_SwapTakeRef") ) deopts_if = variable_used(op, "DEOPT_IF") exits_if = variable_used(op, "EXIT_IF") |