diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2005-12-17 20:54:49 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2005-12-17 20:54:49 (GMT) |
commit | adb69fcdffdc50ee3e1d33b00cd874020197b445 (patch) | |
tree | 9ea2ddcf5d0625a43739da1d5db7915ef597c8b1 /Python/import.c | |
parent | 23a695891069f619b5b992d877820558bb8dc70f (diff) | |
download | cpython-adb69fcdffdc50ee3e1d33b00cd874020197b445.zip cpython-adb69fcdffdc50ee3e1d33b00cd874020197b445.tar.gz cpython-adb69fcdffdc50ee3e1d33b00cd874020197b445.tar.bz2 |
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.
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Python/import.c b/Python/import.c index daa8f8d..f284ff4 100644 --- a/Python/import.c +++ b/Python/import.c @@ -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 @@ parse_source_module(const char *pathname, FILE *fp) { 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; } |