From 6af528b4ab342805534c0bfe61d84ed7bb519468 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 18 Mar 2021 09:54:13 +0100 Subject: bpo-43244: Fix test_peg_generators on Windows (GH-24913) Don't redefine Py_DebugFlag, it's already defined in pydebug.h which is included by Python.h --- Parser/parser.c | 5 ++--- Tools/peg_generator/pegen/c_generator.py | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Parser/parser.c b/Parser/parser.c index acfaf80..6efaebe 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -2,10 +2,9 @@ #include "pegen.h" #if defined(Py_DEBUG) && defined(Py_BUILD_CORE) -extern int Py_DebugFlag; -#define D(x) if (Py_DebugFlag) x; +# define D(x) if (Py_DebugFlag) x; #else -#define D(x) +# define D(x) #endif static const int n_keyword_lists = 9; static KeywordToken *reserved_keywords[] = { diff --git a/Tools/peg_generator/pegen/c_generator.py b/Tools/peg_generator/pegen/c_generator.py index 929ec4f..24418ea 100644 --- a/Tools/peg_generator/pegen/c_generator.py +++ b/Tools/peg_generator/pegen/c_generator.py @@ -31,10 +31,9 @@ EXTENSION_PREFIX = """\ #include "pegen.h" #if defined(Py_DEBUG) && defined(Py_BUILD_CORE) -extern int Py_DebugFlag; -#define D(x) if (Py_DebugFlag) x; +# define D(x) if (Py_DebugFlag) x; #else -#define D(x) +# define D(x) #endif """ -- cgit v0.12