summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorINADA Naoki <methane@users.noreply.github.com>2017-12-14 07:47:20 (GMT)
committerGitHub <noreply@github.com>2017-12-14 07:47:20 (GMT)
commit7ea143ae795a9fd57eaccf490d316bdc13ee9065 (patch)
tree1276bfc657c9a9281c6152ed656a89abdaaff4b8 /Python/compile.c
parentb5fd9ad05e0f15f8272b8f1b829af22077230584 (diff)
downloadcpython-7ea143ae795a9fd57eaccf490d316bdc13ee9065.zip
cpython-7ea143ae795a9fd57eaccf490d316bdc13ee9065.tar.gz
cpython-7ea143ae795a9fd57eaccf490d316bdc13ee9065.tar.bz2
bpo-29469: Move constant folding to AST optimizer (GH-2858)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index a3fcd53..3fd8491 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -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())