mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
[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 6e1e780540
)
Co-authored-by: sobolevn <mail@sobolevn.me>
This commit is contained in:
parent
afcf238ed4
commit
632745ade1
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue