From c0be20ca52c183bdf84ec1bafe5ede1fc95e38e9 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Tue, 9 Aug 2011 16:15:04 -0500 Subject: add a AST validator (closes #12575) --- Python/bltinmodule.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Python/bltinmodule.c') diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 152210b30b..94b2798fee 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -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); -- cgit v1.2.1