diff Python/Python-ast.c @ 75686:9e7f6ddc0d76

free AST's dict
author Benjamin Peterson <benjamin@python.org>
date Wed, 14 Mar 2012 21:50:29 -0500
parents 6bee4eea1efa
children f4d7ad6c9d6e
line wrap: on
line diff
--- a/Python/Python-ast.c	Wed Mar 14 18:17:20 2012 -0700
+++ b/Python/Python-ast.c	Wed Mar 14 21:50:29 2012 -0500
@@ -460,6 +460,12 @@
     PyObject *dict;
 } AST_object;
 
+static void
+ast_dealloc(AST_object *self)
+{
+    Py_CLEAR(self->dict);
+}
+
 static int
 ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
 {
@@ -548,7 +554,7 @@
     "_ast.AST",
     sizeof(AST_object),
     0,
-    0,                       /* tp_dealloc */
+    (destructor)ast_dealloc, /* tp_dealloc */
     0,                       /* tp_print */
     0,                       /* tp_getattr */
     0,                       /* tp_setattr */