summaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2020-08-31 19:30:46 +0200
committerArmin Rigo <arigo@tunes.org>2020-08-31 19:30:46 +0200
commit75aaa036dda345154c21d9699c37537ea9bfeeb1 (patch)
tree35c4cd8af7b8bf2e66ba2bf214bdc48e42ca82a3 /c
parent586159ad522758943ee5c794e583c214fab6084e (diff)
downloadcffi-75aaa036dda345154c21d9699c37537ea9bfeeb1.tar.gz
Don't call PyEval_InitThreads() on CPython >= 3.7, where it should always be a
no-op. It is explicitly deprecated in 3.9.
Diffstat (limited to 'c')
-rw-r--r--c/_cffi_backend.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
index 8f4554f..5693eaf 100644
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -6225,9 +6225,11 @@ static PyObject *prepare_callback_info_tuple(CTypeDescrObject *ct,
infotuple = Py_BuildValue("OOOO", ct, ob, py_rawerr, onerror_ob);
Py_DECREF(py_rawerr);
-#ifdef WITH_THREAD
+#if defined(WITH_THREAD) && PY_VERSION_HEX < 0x03070000
/* We must setup the GIL here, in case the callback is invoked in
- some other non-Pythonic thread. This is the same as ctypes. */
+ some other non-Pythonic thread. This is the same as ctypes.
+ But PyEval_InitThreads() is always a no-op from CPython 3.7
+ (the call from ctypes was removed some time later I think). */
PyEval_InitThreads();
#endif