summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-06-15 15:06:54 (GMT)
committerGitHub <noreply@github.com>2024-06-15 15:06:54 (GMT)
commitcbcb5265bfaf80af386faa8858359bb6f15cb77d (patch)
treeb9356895861acde009e241f7753ff4eaff74858b /Include
parent13a5082afea155b8558c700156e3832548d78b3a (diff)
downloadcpython-cbcb5265bfaf80af386faa8858359bb6f15cb77d.zip
cpython-cbcb5265bfaf80af386faa8858359bb6f15cb77d.tar.gz
cpython-cbcb5265bfaf80af386faa8858359bb6f15cb77d.tar.bz2
[3.13] gh-117657: Make PyType_HasFeature (exported version) atomic (GH-120484) (#120554)
gh-117657: Make PyType_HasFeature (exported version) atomic (GH-120484) Make PyType_HasFeature (exported version) atomic (cherry picked from commit 6f63dfff6f493b405f3422210a168369e1e7a35d) Co-authored-by: Ken Jin <kenjin@python.org>
Diffstat (limited to 'Include')
-rw-r--r--Include/object.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/Include/object.h b/Include/object.h
index a687bf2..7aaa8da 100644
--- a/Include/object.h
+++ b/Include/object.h
@@ -1238,7 +1238,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);
}