summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-03-18 01:46:06 (GMT)
committerGitHub <noreply@github.com>2021-03-18 01:46:06 (GMT)
commite0bf70d08c4a4a68782702e747e6bf7670667591 (patch)
tree36994e29ed642e690b7932129ee150c484fd20d9 /Tools
parent08fb8ac99ab03d767aa0f1cfab3573eddf9df018 (diff)
downloadcpython-e0bf70d08c4a4a68782702e747e6bf7670667591.zip
cpython-e0bf70d08c4a4a68782702e747e6bf7670667591.tar.gz
cpython-e0bf70d08c4a4a68782702e747e6bf7670667591.tar.bz2
bpo-43244: Fix test_peg_generator for PyAST_Validate() (GH-24912)
test_peg_generator now defines _Py_TEST_PEGEN macro when building C code to not call PyAST_Validate() in Parser/pegen.c. Moreover, it defines Py_BUILD_CORE_MODULE macro to get access to the internal C API. Remove "global_ast_state" from Python-ast.c when it's built by test_peg_generator: always get the AST state from the current interpreter.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/peg_generator/pegen/build.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Tools/peg_generator/pegen/build.py b/Tools/peg_generator/pegen/build.py
index 9edde37..b80fc85 100644
--- a/Tools/peg_generator/pegen/build.py
+++ b/Tools/peg_generator/pegen/build.py
@@ -56,6 +56,9 @@ def compile_c_extension(
source_file_path = pathlib.Path(generated_source_path)
extension_name = source_file_path.stem
extra_compile_args = get_extra_flags("CFLAGS", "PY_CFLAGS_NODIST")
+ extra_compile_args.append("-DPy_BUILD_CORE_MODULE")
+ # Define _Py_TEST_PEGEN to not call PyAST_Validate() in Parser/pegen.c
+ extra_compile_args.append('-D_Py_TEST_PEGEN')
extra_link_args = get_extra_flags("LDFLAGS", "PY_LDFLAGS_NODIST")
if keep_asserts:
extra_compile_args.append("-UNDEBUG")