Skip to content

Commit

Permalink
#3808 doh: actually add the patch
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Mar 28, 2023
1 parent 260c312 commit c96f206
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 03ae30013de3fde03719c9b1c9c53b39c389b599 Mon Sep 17 00:00:00 2001
From: Daniele Nicolodi <daniele@grinta.net>
Date: Mon, 27 Mar 2023 21:41:56 +0200
Subject: [PATCH] Fix compilation with CPython 3.12a6

CPython 3.12a6 made PyThreadState an opaque structure thus the fast
thread state optimization cannot be employed anymore.

Fixes #5286.
---
Cython/Utility/ModuleSetupCode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index e461cda1e7..950d89a679 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -331,7 +331,8 @@
#define CYTHON_UNPACK_METHODS 1
#endif
#ifndef CYTHON_FAST_THREAD_STATE
- #define CYTHON_FAST_THREAD_STATE 1
+ // CPython 3.12a6 made PyThreadState an opaque struct.
+ #define CYTHON_FAST_THREAD_STATE (PY_VERSION_HEX < 0x030C00A6)
#endif
#ifndef CYTHON_FAST_GIL
// Py3<3.5.2 does not support _PyThreadState_UncheckedGet().

0 comments on commit c96f206

Please sign in to comment.