8000 gh-120198: Fix crash when two thread edit __class__ by Fidget-Spinner · Pull Request #120195 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-120198: Fix crash when two thread edit __class__ #120195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 11, 2024
Prev Previous commit
Next Next commit
fix bug
Co-Authored-By: Nadeshiko Manju <me@manjusaka.me>
  • Loading branch information
Fidget-Spinner and Zheaoli committed Jun 10, 2024
commit 02a558783e619109f837f61b6ae050dac09831b6
3 changes: 2 additions & 1 deletion Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -6466,7 +6466,6 @@ compatible_for_assignment(PyTypeObject* oldto, PyTypeObject* newto, const char*
static int
object_set_class(PyObject *self, PyObject *value, void *closure)
{
PyTypeObject *oldto = Py_TYPE(self);

if (value == NULL) {
PyErr_SetString(PyExc_TypeError,
Expand All @@ -6486,6 +6485,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
Expand Down
0