diff Python/import.c @ 36065:ea083efdc96c legacy-trunk

Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines, simplifies a lot of error handling code, and fixes many memory leaks.
author Neal Norwitz <nnorwitz@gmail.com>
date Sat, 17 Dec 2005 20:54:49 +0000
parents 9541369b0dca
children 1af7f719ed28
line wrap: on
line diff
--- a/Python/import.c	Sat Dec 17 18:41:15 2005 +0000
+++ b/Python/import.c	Sat Dec 17 20:54:49 2005 +0000
@@ -4,6 +4,7 @@
 #include "Python.h"
 
 #include "Python-ast.h"
+#include "pyarena.h"
 #include "pythonrun.h"
 #include "errcode.h"
 #include "marshal.h"
@@ -773,13 +774,14 @@
 {
 	PyCodeObject *co = NULL;
 	mod_ty mod;
+        PyArena *arena = PyArena_New();
 
 	mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, 0, 
-				   NULL);
+				   NULL, arena);
 	if (mod) {
-		co = PyAST_Compile(mod, pathname, NULL);
-		free_mod(mod);
+		co = PyAST_Compile(mod, pathname, NULL, arena);
 	}
+        PyArena_Free(arena);
 	return co;
 }