From 1d30924b9dd0740b726ae10b0aa4e6b6a6ea213a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Fri, 6 Jan 2023 15:19:56 +0100 Subject: [PATCH] Automatically add build definition Py_DEBUG, when building module for debug build of Python. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- siputils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/siputils.py b/siputils.py index e17518d..6abc6b1 100644 --- a/siputils.py +++ b/siputils.py @@ -856,6 +856,13 @@ class Makefile: cppflags = [] + if getattr(sys, "pydebug", False): + cppflags.append("-DPy_DEBUG") + + if hasattr(sys, "abiflags"): + if 'd' in sys.abiflags: + cppflags.append("-DPy_DEBUG") + if not self._debug: cppflags.append("-DNDEBUG")