https://github.com/python/cpython/commit/632745ade18f5baa39e41613f86114d95c5dce73 commit: 632745ade18f5baa39e41613f86114d95c5dce73 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: kumaraditya303 <[email protected]> date: 2025-01-13T18:09:39+05:30 summary:
[3.13] gh-128759: fix data race in `type_modified_unlocked` (GH-128764) (#128769) * gh-128759: fix data race in `type_modified_unlocked` (GH-128764) (cherry picked from commit 6e1e78054060ad326f26dd8dbf12adfedbb52883) Co-authored-by: sobolevn <[email protected]> files: M Objects/typeobject.c diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 093ebac9b50179..bd79676b8e925f 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -996,9 +996,15 @@ type_modified_unlocked(PyTypeObject *type) We don't assign new version tags eagerly, but only as needed. */ +#ifdef Py_GIL_DISABLED + if (_Py_atomic_load_uint_relaxed(&type->tp_version_tag) == 0) { + return; + } +#else if (type->tp_version_tag == 0) { return; } +#endif // Cannot modify static builtin types. assert((type->tp_flags & _Py_TPFLAGS_STATIC_BUILTIN) == 0); _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
