summaryrefslogtreecommitdiffstats
path: root/Parser/asdl_c.py
diff options
context:
space:
mode:
Diffstat (limited to 'Parser/asdl_c.py')
-rwxr-xr-xParser/asdl_c.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 6b31ffd8..0b72f9e 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -638,9 +638,13 @@ static void
ast_dealloc(AST_object *self)
{
/* bpo-31095: UnTrack is needed before calling any callbacks */
+ PyTypeObject *tp = Py_TYPE(self);
PyObject_GC_UnTrack(self);
Py_CLEAR(self->dict);
- Py_TYPE(self)->tp_free(self);
+ freefunc free_func = PyType_GetSlot(tp, Py_tp_free);
+ assert(free_func != NULL);
+ free_func(self);
+ Py_DECREF(tp);
}
static int