Skip to content

Commit a9f09e0

Browse files
fix: stop-the-world in type_set_qualname
1 parent b643826 commit a9f09e0

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Objects/typeobject.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1594,7 +1594,12 @@ type_set_qualname(PyObject *tp, PyObject *value, void *context)
15941594
}
15951595

15961596
et = (PyHeapTypeObject*)type;
1597-
Py_SETREF(et->ht_qualname, Py_NewRef(value));
1597+
PyInterpreterState *interp = _PyInterpreterState_GET();
1598+
_PyEval_StopTheWorld(interp);
1599+
PyObject *old_qualname = et->ht_qualname;
1600+
et->ht_qualname = Py_NewRef(value);
1601+
_PyEval_StartTheWorld(interp);
1602+
Py_DECREF(old_qualname);
15981603
return 0;
15991604
}
16001605

0 commit comments

Comments
 (0)