From bd260da900b5c5f16e5c61f6795d08171b33e0f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Sun, 26 Feb 2006 19:42:26 +0000 Subject: Generate code to recursively copy an AST into a tree of Python objects. Expose this through compile(). --- Python/pythonrun.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Python/pythonrun.c') 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; -- cgit v1.2.1