diff options
author | Ken Jin <kenjin@python.org> | 2024-06-15 14:39:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-15 14:39:22 (GMT) |
commit | 6f63dfff6f493b405f3422210a168369e1e7a35d (patch) | |
tree | 687ba8cc9bfaeb2d460447172b39464935b6a5c0 /Include/object.h | |
parent | 99d62f902e43c08ebec5a292fd3b30a9fc4cba69 (diff) | |
download | cpython-6f63dfff6f493b405f3422210a168369e1e7a35d.zip cpython-6f63dfff6f493b405f3422210a168369e1e7a35d.tar.gz cpython-6f63dfff6f493b405f3422210a168369e1e7a35d.tar.bz2 |
gh-117657: Make PyType_HasFeature (exported version) atomic (#120484)
Make PyType_HasFeature (exported version) atomic
Diffstat (limited to 'Include/object.h')
-rw-r--r-- | Include/object.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Include/object.h b/Include/object.h index 4a39ada..f71aaee 100644 --- a/Include/object.h +++ b/Include/object.h @@ -756,7 +756,11 @@ PyType_HasFeature(PyTypeObject *type, unsigned long feature) // PyTypeObject is opaque in the limited C API flags = PyType_GetFlags(type); #else - flags = type->tp_flags; +# ifdef Py_GIL_DISABLED + flags = _Py_atomic_load_ulong_relaxed(&type->tp_flags); +# else + flags = type->tp_flags; +# endif #endif return ((flags & feature) != 0); } |