Generate code to recursively copy an AST into

a tree of Python objects. Expose this through compile().
This commit is contained in:
Martin v. Löwis 2006-02-26 19:42:26 +00:00
parent 23b0dc5053
commit bd260da900
8 changed files with 1906 additions and 745 deletions

View file

@ -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;