diff options
author | Ken Jin <kenjin@python.org> | 2024-06-11 19:10:23 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 19:10:23 (GMT) |
commit | 203565b2f9c74656ba519780049b46d4e5afcba1 (patch) | |
tree | 009a4eadfbdfe04f89628880010860a67125441c /Objects | |
parent | 939c201e00943c6dc2d515185168c30606ae522c (diff) | |
download | cpython-203565b2f9c74656ba519780049b46d4e5afcba1.zip cpython-203565b2f9c74656ba519780049b46d4e5afcba1.tar.gz cpython-203565b2f9c74656ba519780049b46d4e5afcba1.tar.bz2 |
gh-120198: Fix race condition when editing __class__ with an audit hook active (GH-120195)
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c index cd16beb..070e3d2 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6522,7 +6522,6 @@ differs: static int object_set_class(PyObject *self, PyObject *value, void *closure) { - PyTypeObject *oldto = Py_TYPE(self); if (value == NULL) { PyErr_SetString(PyExc_TypeError, @@ -6542,6 +6541,8 @@ object_set_class(PyObject *self, PyObject *value, void *closure) return -1; } + PyTypeObject *oldto = Py_TYPE(self); + /* In versions of CPython prior to 3.5, the code in compatible_for_assignment was not set up to correctly check for memory layout / slot / etc. compatibility for non-HEAPTYPE classes, so we just |