bpo-29469: Move constant folding to AST optimizer (GH-2858)

This commit is contained in:
INADA Naoki 2017-12-14 16:47:20 +09:00 committed by GitHub
parent b5fd9ad05e
commit 7ea143ae79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 4432 additions and 3967 deletions

View file

@ -331,6 +331,10 @@ PyAST_CompileObject(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
c.c_optimize = (optimize == -1) ? Py_OptimizeFlag : optimize;
c.c_nestlevel = 0;
if (!_PyAST_Optimize(mod, arena)) {
goto finally;
}
c.c_st = PySymtable_BuildObject(mod, filename, c.c_future);
if (c.c_st == NULL) {
if (!PyErr_Occurred())