diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-02-26 19:42:26 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-02-26 19:42:26 (GMT) |
commit | bd260da900b5c5f16e5c61f6795d08171b33e0f8 (patch) | |
tree | 0880faf7b6da37250984d1a0e6e6c5a0faa25f06 /Python/pythonrun.c | |
parent | 23b0dc50535d7eaf2f322b04da7a7f86815fcc8f (diff) | |
download | cpython-bd260da900b5c5f16e5c61f6795d08171b33e0f8.zip cpython-bd260da900b5c5f16e5c61f6795d08171b33e0f8.tar.gz cpython-bd260da900b5c5f16e5c61f6795d08171b33e0f8.tar.bz2 |
Generate code to recursively copy an AST into
a tree of Python objects. Expose this through compile().
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 0b7de42..3cb03dc 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1254,6 +1254,11 @@ Py_CompileStringFlags(const char *str, const char *filename, int start, PyArena_Free(arena); return NULL; } + if (flags->cf_flags & PyCF_ONLY_AST) { + PyObject *result = PyAST_mod2obj(mod); + PyArena_Free(arena); + return result; + } co = PyAST_Compile(mod, filename, flags, arena); PyArena_Free(arena); return (PyObject *)co; |