summaryrefslogtreecommitdiffstats
path: root/Include/cpython/object.h
diff options
context:
space:
mode:
authorDino Viehland <dinoviehland@meta.com>2024-05-06 17:50:35 (GMT)
committerGitHub <noreply@github.com>2024-05-06 17:50:35 (GMT)
commit5a1618a2c8c108b8c73aa9459b63f0dbd66b60f6 (patch)
treea9b79e4cb8e0a9d1d648e21619382a03363c1f46 /Include/cpython/object.h
parente6b213ee3ffb05f067d30cb8bb45681887212444 (diff)
downloadcpython-5a1618a2c8c108b8c73aa9459b63f0dbd66b60f6.zip
cpython-5a1618a2c8c108b8c73aa9459b63f0dbd66b60f6.tar.gz
cpython-5a1618a2c8c108b8c73aa9459b63f0dbd66b60f6.tar.bz2
gh-118362: Fix thread safety around lookups from the type cache in the face of concurrent mutators (#118454)
Add _PyType_LookupRef and use incref before setting attribute on type Makes setting an attribute on a class and signaling type modified atomic Avoid adding re-entrancy exposing the type cache in an inconsistent state by decrefing after type is updated
Diffstat (limited to 'Include/cpython/object.h')
-rw-r--r--Include/cpython/object.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index c2830b7..e624326 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -275,6 +275,7 @@ typedef struct _heaptypeobject {
PyAPI_FUNC(const char *) _PyType_Name(PyTypeObject *);
PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *);
+PyAPI_FUNC(PyObject *) _PyType_LookupRef(PyTypeObject *, PyObject *);
PyAPI_FUNC(PyObject *) PyType_GetDict(PyTypeObject *);
PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int);