mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Generate code to recursively copy an AST into
a tree of Python objects. Expose this through compile().
This commit is contained in:
parent
23b0dc5053
commit
bd260da900
8 changed files with 1906 additions and 745 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue