Skip to content

Commit ea0aeff

Browse files
Add clear_static_type_interp_data().
1 parent f65fe66 commit ea0aeff

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Objects/typeobject.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4544,18 +4544,24 @@ clear_static_tp_subclasses(PyTypeObject *type)
45444544
clear_subclasses(type);
45454545
}
45464546

4547+
static void
4548+
clear_static_type_interp_data(PyTypeObject *type)
4549+
{
4550+
Py_CLEAR(type->tp_dict);
4551+
Py_CLEAR(type->tp_bases);
4552+
Py_CLEAR(type->tp_mro);
4553+
clear_static_tp_subclasses(type);
4554+
}
4555+
45474556
void
45484557
_PyStaticType_Dealloc(PyTypeObject *type)
45494558
{
45504559
assert(!(type->tp_flags & Py_TPFLAGS_HEAPTYPE));
45514560

45524561
type_dealloc_common(type);
45534562

4554-
Py_CLEAR(type->tp_dict);
4555-
Py_CLEAR(type->tp_bases);
4556-
Py_CLEAR(type->tp_mro);
45574563
Py_CLEAR(type->tp_cache);
4558-
clear_static_tp_subclasses(type);
4564+
clear_static_type_interp_data(type);
45594565

45604566
// PyObject_ClearWeakRefs() raises an exception if Py_REFCNT() != 0
45614567
if (Py_REFCNT(type) == 0) {

0 commit comments

Comments
 (0)