Skip to content

Commit dfcd1bf

Browse files
decref after starting world
1 parent b124620 commit dfcd1bf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Objects/typeobject.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,8 +1538,10 @@ type_set_name(PyObject *tp, PyObject *value, void *Py_UNUSED(closure))
15381538
PyInterpreterState *interp = _PyInterpreterState_GET();
15391539
_PyEval_StopTheWorld(interp);
15401540
type->tp_name = tp_name;
1541-
Py_SETREF(((PyHeapTypeObject*)type)->ht_name, Py_NewRef(value));
1541+
PyObject *old_name = ((PyHeapTypeObject*)type)->ht_name;
1542+
((PyHeapTypeObject*)type)->ht_name = Py_NewRef(value);
15421543
_PyEval_StartTheWorld(interp);
1544+
Py_DECREF(old_name);
15431545
return 0;
15441546
}
15451547

0 commit comments

Comments
 (0)