summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Parser/asdl_c.py')
-rw-r--r--Parser/asdl_c.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 13124bbd3ad..1e5f4d9a2a5 100644
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -630,6 +630,8 @@ typedef struct {
static void
ast_dealloc(AST_object *self)
{
+ /* bpo-31095: UnTrack is needed before calling any callbacks */
+ PyObject_GC_UnTrack(self);
Py_CLEAR(self->dict);
Py_TYPE(self)->tp_free(self);
}