mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
gh-120198: Fix race condition when editing __class__ with an audit hook active (GH-120195)
This commit is contained in:
parent
939c201e00
commit
203565b2f9
4 changed files with 38 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue