Skip to content

Commit 45a26f3

Browse files
Don't call PyDict_Type stuff directly from dealloc, traverse, and clear
1 parent 0bce276 commit 45a26f3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/_collectionsmodule.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -2067,7 +2067,7 @@ defdict_dealloc(defdictobject *dd)
20672067
PyTypeObject *tp = Py_TYPE(dd);
20682068
PyObject_GC_UnTrack(dd);
20692069
tp->tp_clear((PyObject *)dd);
2070-
PyDict_Type.tp_dealloc((PyObject *)dd);
2070+
tp->tp_free((PyObject *)dd);
20712071
Py_DECREF(tp);
20722072
}
20732073

@@ -2142,14 +2142,14 @@ defdict_traverse(PyObject *self, visitproc visit, void *arg)
21422142
{
21432143
Py_VISIT(Py_TYPE(self));
21442144
Py_VISIT(((defdictobject *)self)->default_factory);
2145-
return PyDict_Type.tp_traverse(self, visit, arg);
2145+
return 0;
21462146
}
21472147

21482148
static int
21492149
defdict_tp_clear(defdictobject *dd)
21502150
{
21512151
Py_CLEAR(dd->default_factory);
2152-
return PyDict_Type.tp_clear((PyObject *)dd);
2152+
return 0;
21532153
}
21542154

21552155
static int

0 commit comments

Comments
 (0)