summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3
diff options
context:
space:
mode:
authorshadchin <[email protected]>2026-04-11 20:54:24 +0300
committershadchin <[email protected]>2026-04-11 21:12:23 +0300
commit467f8e26f672fa7ddf8c1f74f495c376e36d302d (patch)
treeb5fe451149dda33760b2fb091a7df7a2b1cf1fda /contrib/tools/python3
parentb1855ac6de8eb21270558ba8790e23fe75070d26 (diff)
Rework `pyconfig.h`
commit_hash:826de8ce55126c9f2a15bb1dcdd1227e0e069615
Diffstat (limited to 'contrib/tools/python3')
-rw-r--r--contrib/tools/python3/Include/pyconfig-linux.h10
-rw-r--r--contrib/tools/python3/Include/pyconfig-osx.h10
-rw-r--r--contrib/tools/python3/Include/pyconfig-win.h8
-rw-r--r--contrib/tools/python3/Include/pyconfig.h18
-rw-r--r--contrib/tools/python3/PC/pyconfig.h.in6
-rw-r--r--contrib/tools/python3/patches/01-pyconfig.patch24
-rw-r--r--contrib/tools/python3/patches/02-pyconfig-mimalloc.patch (renamed from contrib/tools/python3/patches/xxx-mimalloc.patch)4
-rw-r--r--contrib/tools/python3/patches/all-changes.patch23
8 files changed, 50 insertions, 53 deletions
diff --git a/contrib/tools/python3/Include/pyconfig-linux.h b/contrib/tools/python3/Include/pyconfig-linux.h
index 4756073fb8f..8dc6c6101e1 100644
--- a/contrib/tools/python3/Include/pyconfig-linux.h
+++ b/contrib/tools/python3/Include/pyconfig-linux.h
@@ -1692,13 +1692,7 @@
#define PY_SUPPORT_TIER 1
/* Define if you want to build an interpreter with many run-time checks. */
-#if !defined(NDEBUG) && !defined(Py_LIMITED_API) && !defined(DISABLE_PYDEBUG)
-#define Py_DEBUG
-#define GC_NDEBUG
-#define ABIFLAGS "d"
-#else
-#define ABIFLAGS ""
-#endif
+/* #undef Py_DEBUG */
/* Defined if Python is built as a shared library. */
/* #undef Py_ENABLE_SHARED */
@@ -1929,9 +1923,7 @@
/* #undef WITH_NEXT_FRAMEWORK */
/* Define if you want to compile in Python-specific mallocs */
-#ifndef address_sanitizer_enabled
#define WITH_PYMALLOC 1
-#endif
/* Define if you want pymalloc to be disabled when running under valgrind */
/* #undef WITH_VALGRIND */
diff --git a/contrib/tools/python3/Include/pyconfig-osx.h b/contrib/tools/python3/Include/pyconfig-osx.h
index 80f7aa88619..ba76e8570f4 100644
--- a/contrib/tools/python3/Include/pyconfig-osx.h
+++ b/contrib/tools/python3/Include/pyconfig-osx.h
@@ -1690,13 +1690,7 @@
#define PY_SUPPORT_TIER 1
/* Define if you want to build an interpreter with many run-time checks. */
-#if !defined(NDEBUG) && !defined(Py_LIMITED_API) && !defined(DISABLE_PYDEBUG)
-#define Py_DEBUG
-#define GC_NDEBUG
-#define ABIFLAGS "d"
-#else
-#define ABIFLAGS ""
-#endif
+/* #undef Py_DEBUG */
/* Defined if Python is built as a shared library. */
/* #undef Py_ENABLE_SHARED */
@@ -1927,9 +1921,7 @@
/* #undef WITH_NEXT_FRAMEWORK */
/* Define if you want to compile in Python-specific mallocs */
-#ifndef address_sanitizer_enabled
#define WITH_PYMALLOC 1
-#endif
/* Define if you want pymalloc to be disabled when running under valgrind */
/* #undef WITH_VALGRIND */
diff --git a/contrib/tools/python3/Include/pyconfig-win.h b/contrib/tools/python3/Include/pyconfig-win.h
index 7613a481dd6..b0c55a3beef 100644
--- a/contrib/tools/python3/Include/pyconfig-win.h
+++ b/contrib/tools/python3/Include/pyconfig-win.h
@@ -7,12 +7,4 @@
/* Define to 1 if you want to build _blake2 module with libb2 */
#define HAVE_LIBB2 1
-#if !defined(NDEBUG) && !defined(Py_LIMITED_API) && !defined(DISABLE_PYDEBUG)
-#define Py_DEBUG
-#define GC_NDEBUG
-#define ABIFLAGS "d"
-#else
-#define ABIFLAGS ""
-#endif
-
#include "../PC/pyconfig.h.in"
diff --git a/contrib/tools/python3/Include/pyconfig.h b/contrib/tools/python3/Include/pyconfig.h
index f8de6597892..d3a8647f708 100644
--- a/contrib/tools/python3/Include/pyconfig.h
+++ b/contrib/tools/python3/Include/pyconfig.h
@@ -12,6 +12,24 @@
# include "pyconfig-musl.h"
#endif
+#undef Py_DEBUG
+
+/* Define if you want to build an interpreter with many run-time checks. */
+#if !defined(NDEBUG) && !defined(Py_LIMITED_API) && !defined(DISABLE_PYDEBUG)
+#define Py_DEBUG
+#define GC_NDEBUG
+#endif
+
+#ifdef Py_DEBUG
+#define ABIFLAGS "d"
+#else
+#define ABIFLAGS ""
+#endif
+
+#ifdef address_sanitizer_enabled
+#undef WITH_PYMALLOC
+#endif
+
#if WITH_MIMALLOC
#define _mi_abandoned_await_readers _python3__mi_abandoned_await_readers
diff --git a/contrib/tools/python3/PC/pyconfig.h.in b/contrib/tools/python3/PC/pyconfig.h.in
index 9a23cf79efd..424421f6ff1 100644
--- a/contrib/tools/python3/PC/pyconfig.h.in
+++ b/contrib/tools/python3/PC/pyconfig.h.in
@@ -372,6 +372,10 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
# define ALIGNOF_MAX_ALIGN_T 8
#endif
+#ifdef _DEBUG
+# define Py_DEBUG
+#endif
+
#ifdef MS_WIN32
@@ -522,9 +526,7 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* #define WITH_READLINE 1 */
/* Use Python's own small-block memory-allocator. */
-#ifndef address_sanitizer_enabled
#define WITH_PYMALLOC 1
-#endif
/* Define if you want to compile in mimalloc memory allocator. */
#define WITH_MIMALLOC 1
diff --git a/contrib/tools/python3/patches/01-pyconfig.patch b/contrib/tools/python3/patches/01-pyconfig.patch
new file mode 100644
index 00000000000..9681cbc6b81
--- /dev/null
+++ b/contrib/tools/python3/patches/01-pyconfig.patch
@@ -0,0 +1,24 @@
+--- contrib/tools/python3/Include/pyconfig.h (index)
++++ contrib/tools/python3/Include/pyconfig.h (working tree)
+@@ -12,3 +12,21 @@
+ #if defined(_musl_)
+ # include "pyconfig-musl.h"
+ #endif
++
++#undef Py_DEBUG
++
++/* Define if you want to build an interpreter with many run-time checks. */
++#if !defined(NDEBUG) && !defined(Py_LIMITED_API) && !defined(DISABLE_PYDEBUG)
++#define Py_DEBUG
++#define GC_NDEBUG
++#endif
++
++#ifdef Py_DEBUG
++#define ABIFLAGS "d"
++#else
++#define ABIFLAGS ""
++#endif
++
++#ifdef address_sanitizer_enabled
++#undef WITH_PYMALLOC
++#endif
diff --git a/contrib/tools/python3/patches/xxx-mimalloc.patch b/contrib/tools/python3/patches/02-pyconfig-mimalloc.patch
index ef1060c608a..cc7c41a7237 100644
--- a/contrib/tools/python3/patches/xxx-mimalloc.patch
+++ b/contrib/tools/python3/patches/02-pyconfig-mimalloc.patch
@@ -1,8 +1,8 @@
--- contrib/tools/python3/Include/pyconfig.h (index)
+++ contrib/tools/python3/Include/pyconfig.h (working tree)
@@ -13,3 +13,296 @@
- #if defined(_musl_)
- # include "pyconfig-musl.h"
+ #ifdef address_sanitizer_enabled
+ #undef WITH_PYMALLOC
#endif
+
+#if WITH_MIMALLOC
diff --git a/contrib/tools/python3/patches/all-changes.patch b/contrib/tools/python3/patches/all-changes.patch
index 6e75bf4c8ee..1678bd0dc31 100644
--- a/contrib/tools/python3/patches/all-changes.patch
+++ b/contrib/tools/python3/patches/all-changes.patch
@@ -150,29 +150,6 @@
/* pass NULL as the config: config is read from command line arguments,
environment variables, configuration files */
---- a/PC/pyconfig.h.in (index)
-+++ b/PC/pyconfig.h.in (working tree)
-@@ -306,10 +306,6 @@
- # endif
- #endif
-
--#ifdef _DEBUG
--# define Py_DEBUG
--#endif
--
-
- #ifdef MS_WIN32
-
-@@ -460,7 +456,9 @@
- /* #define WITH_READLINE 1 */
-
- /* Use Python's own small-block memory-allocator. */
-+#ifndef address_sanitizer_enabled
- #define WITH_PYMALLOC 1
-+#endif
-
- /* Define if you want to compile in mimalloc memory allocator. */
- #define WITH_MIMALLOC 1
--- a/Python/initconfig.c (index)
+++ b/Python/initconfig.c (working tree)
@@ -163,7 +163,7 @@ int Py_InspectFlag = 0; /* Needed to determine whether to exit at SystemExit */