diff --git a/Parser/pegen/parse.c b/Parser/pegen/parse.c index 2b735472ad6..b63924177d4 100644 --- a/Parser/pegen/parse.c +++ b/Parser/pegen/parse.c @@ -1,7 +1,7 @@ // @generated by pegen.py from ./Grammar/python.gram #include "pegen.h" -#ifdef Py_DEBUG +#if defined(Py_DEBUG) && defined(Py_BUILD_CORE) extern int Py_DebugFlag; #define D(x) if (Py_DebugFlag) x; #else diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index ff7e75a9fdf..8bc23911bbb 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -29,7 +29,7 @@ from pegen.parser_generator import ParserGenerator EXTENSION_PREFIX = """\ #include "pegen.h" -#ifdef Py_DEBUG +#if defined(Py_DEBUG) && defined(Py_BUILD_CORE) extern int Py_DebugFlag; #define D(x) if (Py_DebugFlag) x; #else