depot/nix/pkgs/authentik/pythonapp/cython-disable-trashcan.patch

37 lines
1.6 KiB
Diff
Raw Normal View History

From e337825cdcf5e94d38ba06a0cb0188e99ce0cc92 Mon Sep 17 00:00:00 2001
From: da-woods <dw-git@d-woods.co.uk>
Date: Tue, 23 Nov 2021 13:55:58 +0000
Subject: [PATCH] Disable Cython copy of trashcan implementation in Py3.8+
(GH-4475)
If I understand correctly, the Cython-specific reimplementation
of trashcan isn't needed of Python 3.8+ (because the patch it
was based on was merged into Python). Therefore on these versions
it can be disabled and the Python macros used instead.
This is specifically needed for Python 3.11 since it removes or
hides functions that are used in the Cython reimplementation.
However, I've gone back further.
---
Cython/Utility/ExtensionTypes.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Cython/Utility/ExtensionTypes.c b/Cython/Utility/ExtensionTypes.c
index 7e497eeb88..7d19ab33f2 100644
--- a/Cython/Utility/ExtensionTypes.c
+++ b/Cython/Utility/ExtensionTypes.c
@@ -276,7 +276,12 @@ static int __Pyx_PyType_Ready(PyTypeObject *t) {
// This requires CPython version >= 2.7.4
// (or >= 3.2.4 but we don't support such old Python 3 versions anyway)
-#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070400
+#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03080000
+// https://github.com/python/cpython/pull/11841 merged so Cython reimplementation
+// is no longer necessary
+#define __Pyx_TRASHCAN_BEGIN Py_TRASHCAN_BEGIN
+#define __Pyx_TRASHCAN_END Py_TRASHCAN_END
+#elif CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070400
#define __Pyx_TRASHCAN_BEGIN_CONDITION(op, cond) \
do { \
PyThreadState *_tstate = NULL; \