bpo-29469: Move constant folding to AST optimizer (GH-2858) · python/cpython@7ea143a · GitHub
Skip to content

Commit 7ea143a

Browse files
authored
bpo-29469: Move constant folding to AST optimizer (GH-2858)
1 parent b5fd9ad commit 7ea143a

11 files changed

Lines changed: 4431 additions & 3966 deletions

File tree

Doc/whatsnew/3.7.rst

Lines changed: 3 additions & 0 deletions

Include/compile.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
7575
#define PY_INVALID_STACK_EFFECT INT_MAX
7676
PyAPI_FUNC(int) PyCompile_OpcodeStackEffect(int opcode, int oparg);
7777

78+
PyAPI_FUNC(int) _PyAST_Optimize(struct _mod *, PyArena *arena);
79+
7880
#ifdef __cplusplus
7981
}
8082
#endif

Makefile.pre.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,7 @@ PYTHON_OBJS= \
319319
Python/Python-ast.o \
320320
Python/asdl.o \
321321
Python/ast.o \
322+
Python/ast_opt.o \
322323
Python/bltinmodule.o \
323324
Python/ceval.o \
324325
Python/compile.o \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Move constant folding from bytecode layer to AST layer.
2+
Original patch by Eugene Toder.

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@
356356
<ClCompile Include="..\Python\_warnings.c" />
357357
<ClCompile Include="..\Python\asdl.c" />
358358
<ClCompile Include="..\Python\ast.c" />
359+
<ClCompile Include="..\Python\ast_opt.c" />
359360
<ClCompile Include="..\Python\bltinmodule.c" />
360361
<ClCompile Include="..\Python\bootstrap_hash.c" />
361362
<ClCompile Include="..\Python\ceval.c" />

PCbuild/pythoncore.vcxproj.filters

Lines changed: 3 additions & 0 deletions

0 commit comments

Comments
 (0)