Skip to content
Prev Previous commit
Next Next commit
restrict to heap types
  • Loading branch information
JelleZijlstra committed Jul 23, 2025
commit 52c7d2bb6e192b25909850697a3174df689bb6d6
4 changes: 4 additions & 0 deletions Python/sysmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -2661,6 +2661,10 @@ sys__clear_type_descriptors(PyObject *module, PyObject *type)
return NULL;
}
PyTypeObject *typeobj = (PyTypeObject *)(type);
Comment thread
JelleZijlstra marked this conversation as resolved.
Outdated
if (!_PyType_HasFeature(typeobj, Py_TPFLAGS_HEAPTYPE)) {
PyErr_SetString(PyExc_TypeError, "argument must be a heap type");
Comment thread
JelleZijlstra marked this conversation as resolved.
Outdated
return NULL;
}
PyObject *dict = _PyType_GetDict(typeobj);
if (PyDict_PopString(dict, "__dict__", NULL) < 0) {
return NULL;
Expand Down
Loading