mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
gh-130139: always check ast node type in ast.parse() with ast input (#130140)
This commit is contained in:
parent
2e8044a4f7
commit
c9b1bf302c
8 changed files with 73 additions and 32 deletions
|
@ -835,6 +835,9 @@ builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
|
|||
goto error;
|
||||
if (is_ast) {
|
||||
if ((flags & PyCF_OPTIMIZED_AST) == PyCF_ONLY_AST) {
|
||||
if (PyAst_CheckMode(source, compile_mode) < 0) {
|
||||
goto error;
|
||||
}
|
||||
// return an un-optimized AST
|
||||
result = Py_NewRef(source);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue