diff options
author | Victor Stinner <vstinner@python.org> | 2021-03-18 01:46:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-18 01:46:06 (GMT) |
commit | e0bf70d08c4a4a68782702e747e6bf7670667591 (patch) | |
tree | 36994e29ed642e690b7932129ee150c484fd20d9 /Parser/pegen.c | |
parent | 08fb8ac99ab03d767aa0f1cfab3573eddf9df018 (diff) | |
download | cpython-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 'Parser/pegen.c')
-rw-r--r-- | Parser/pegen.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Parser/pegen.c b/Parser/pegen.c index 3011993..84bdf8d 100644 --- a/Parser/pegen.c +++ b/Parser/pegen.c @@ -1265,7 +1265,8 @@ _PyPegen_run_parser(Parser *p) return RAISE_SYNTAX_ERROR("multiple statements found while compiling a single statement"); } -#if defined(Py_DEBUG) && defined(Py_BUILD_CORE) + // test_peg_generator defines _Py_TEST_PEGEN to not call PyAST_Validate() +#if defined(Py_DEBUG) && !defined(_Py_TEST_PEGEN) if (p->start_rule == Py_single_input || p->start_rule == Py_file_input || p->start_rule == Py_eval_input) |