Skip to content

Commit 81632c6

Browse files
committed
[TEMP] bpo-11105: use PY_LOCAL()s for AST converter functions
1 parent fa106a6 commit 81632c6

File tree

2 files changed

+30
-20
lines changed

2 files changed

+30
-20
lines changed

‎Parser/asdl_c.py‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ def recursive_call(self, node, level):
432432

433433
def funcHeader(self, name):
434434
ctype = get_c_type(name)
435-
self.emit("int", 0)
435+
self.emit("Py_LOCAL_INLINE(int)", 0)
436436
self.emit("obj2ast_%s(struct ast_state *state, PyObject* obj, %s* out, PyArena* arena)" % (name, ctype), 0)
437437
self.emit("{", 0)
438438
self.emit("int isinstance;", 1)
@@ -514,7 +514,7 @@ def visitSum(self, sum, name):
514514

515515
def visitProduct(self, prod, name):
516516
ctype = get_c_type(name)
517-
self.emit("int", 0)
517+
self.emit("Py_LOCAL_INLINE(int)", 0)
518518
self.emit("obj2ast_%s(struct ast_state *state, PyObject* obj, %s* out, PyArena* arena)" % (name, ctype), 0)
519519
self.emit("{", 0)
520520
self.emit("PyObject* tmp = NULL;", 1)
@@ -1434,6 +1434,11 @@ def generate_module_def(mod, f, internal_h):
14341434
generate_ast_state(module_state, internal_h)
14351435

14361436
print(textwrap.dedent("""
1437+
/* enable more aggressive intra-module optimizations, where available
1438+
to reduce the stack usage for windows. */
1439+
1440+
#define PY_LOCAL_AGGRESSIVE
1441+
14371442
#include "Python.h"
14381443
#include "pycore_ast.h"
14391444
#include "pycore_ast_state.h" // struct ast_state

‎Python/Python-ast.c‎

Lines changed: 23 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)