[Python-checkins] cpython: Issue #15291: Fix a memory leak where AST nodes where not properly deallocated.

antoine.pitrou python-checkins at python.org
Sun Jul 8 12:45:25 CEST 2012


http://hg.python.org/cpython/rev/048d8d9aecf1
changeset:   77998:048d8d9aecf1
parent:      77996:8c877ad00bc4
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Sun Jul 08 12:43:32 2012 +0200
summary:
  Issue #15291: Fix a memory leak where AST nodes where not properly deallocated.

files:
  Misc/NEWS           |  3 +++
  Parser/asdl_c.py    |  1 +
  Python/Python-ast.c |  1 +
  3 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -10,6 +10,9 @@
 Core and Builtins
 -----------------
 
+- Issue #15291: Fix a memory leak where AST nodes where not properly
+  deallocated.
+
 - Issue #15110: Fix the tracebacks generated by "import xxx" to not show
   the importlib stack frames.
 
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -612,6 +612,7 @@
 ast_dealloc(AST_object *self)
 {
     Py_CLEAR(self->dict);
+    Py_TYPE(self)->tp_free(self);
 }
 
 static int
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -464,6 +464,7 @@
 ast_dealloc(AST_object *self)
 {
     Py_CLEAR(self->dict);
+    Py_TYPE(self)->tp_free(self);
 }
 
 static int

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list