add a AST validator (closes #12575)

This commit is contained in:
Benjamin Peterson 2011-08-09 16:15:04 -05:00
parent 450bb594c8
commit 832bfe2ebd
5 changed files with 897 additions and 6 deletions

View file

@ -604,6 +604,10 @@ builtin_compile(PyObject *self, PyObject *args, PyObject *kwds)
PyArena_Free(arena);
goto error;
}
if (!PyAST_Validate(mod)) {
PyArena_Free(arena);
goto error;
}
result = (PyObject*)PyAST_CompileEx(mod, filename,
&cf, optimize, arena);
PyArena_Free(arena);