Cython/3397705da0.patch
2023-03-07 10:09:28 +01:00

34 lines
1.4 KiB
Diff

From 3397705da036bb2df4a5b8b4bf08dbad7bdb409f Mon Sep 17 00:00:00 2001
From: Stefan Behnel <stefan_ml@behnel.de>
Date: Tue, 7 Mar 2023 08:43:06 +0100
Subject: [PATCH] Stop using PyLong internals and dict versioning in Py3.12 for
0.29.x (handled differently in master).
---
Cython/Utility/ModuleSetupCode.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index 33aac2c4a7..e8fe62be00 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -208,7 +208,8 @@
#undef CYTHON_USE_PYLONG_INTERNALS
#define CYTHON_USE_PYLONG_INTERNALS 0
#elif !defined(CYTHON_USE_PYLONG_INTERNALS)
- #define CYTHON_USE_PYLONG_INTERNALS 1
+ // PyLong internals changed in Py3.12.
+ #define CYTHON_USE_PYLONG_INTERNALS (PY_VERSION_HEX < 0x030C00A5)
#endif
#ifndef CYTHON_USE_PYLIST_INTERNALS
#define CYTHON_USE_PYLIST_INTERNALS 1
@@ -252,7 +253,8 @@
#define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
#endif
#ifndef CYTHON_USE_DICT_VERSIONS
- #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
+ // The dict version field is now deprecated in Py3.12.
+ #define CYTHON_USE_DICT_VERSIONS ((PY_VERSION_HEX >= 0x030600B1) && (PY_VERSION_HEX < 0x030C00A5))
#endif
#if PY_VERSION_HEX >= 0x030B00A4
#undef CYTHON_USE_EXC_INFO_STACK