summaryrefslogtreecommitdiffstats
path: root/Python/Python-tokenize.c
diff options
context:
space:
mode:
authormpage <mpage@meta.com>2024-03-29 17:42:02 (GMT)
committerGitHub <noreply@github.com>2024-03-29 17:42:02 (GMT)
commit5d21d884b6ffa45dac50a5f9a07c41356a8478b4 (patch)
tree691b5682cf6b97626cd967a47feec149d50c2914 /Python/Python-tokenize.c
parent19c1dd60c5b53fb0533610ad139ef591294f26e8 (diff)
downloadcpython-5d21d884b6ffa45dac50a5f9a07c41356a8478b4.zip
cpython-5d21d884b6ffa45dac50a5f9a07c41356a8478b4.tar.gz
cpython-5d21d884b6ffa45dac50a5f9a07c41356a8478b4.tar.bz2
gh-111926: Avoid locking in PyType_IsSubtype (#117275)
Read the MRO in a thread-unsafe way in `PyType_IsSubtype` to avoid locking. Fixing this is tracked in #117306. The motivation for this change is in support of making weakrefs thread-safe in free-threaded builds: `WeakValueDictionary` uses a special dictionary function, `_PyDict_DelItemIf` to remove dead weakrefs from the dictionary. `_PyDict_DelItemIf` removes a key if a user supplied predicate evaluates to true for the value associated with the key. Crucially for the `WeakValueDictionary` use case, the predicate evaluation + deletion sequence is atomic, provided that the predicate doesn’t suspend. The predicate used by `WeakValueDictionary` includes a subtype check, which we must ensure doesn't suspend in free-threaded builds.
Diffstat (limited to 'Python/Python-tokenize.c')
0 files changed, 0 insertions, 0 deletions