summaryrefslogtreecommitdiff
path: root/Python/pythonrun.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-02-26 19:42:26 +0000
committerMartin v. Löwis <martin@v.loewis.de>2006-02-26 19:42:26 +0000
commit7ea809c12fdbd57b820f4c63ed5969552d20b3d2 (patch)
tree78938c4bcc77916c0102c75fd84f1201e2481e7a /Python/pythonrun.c
parent8548befae1c2fa2f0e607a39917f789c0a078235 (diff)
downloadcpython-7ea809c12fdbd57b820f4c63ed5969552d20b3d2.tar.gz
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.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 0b7de4297d..3cb03dc362 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;