From 27969fc0c6e5407602c776270bcdcce1ec127b30 Mon Sep 17 00:00:00 2001 From: Daniel Bershatsky Date: Thu, 27 Mar 2025 20:15:47 +0300 Subject: [PATCH] Maintain compatibility with CPython 3.13 --- cassandra/io/libevwrapper.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cassandra/io/libevwrapper.c b/cassandra/io/libevwrapper.c index 99e1df30f7..44612adb8a 100644 --- a/cassandra/io/libevwrapper.c +++ b/cassandra/io/libevwrapper.c @@ -665,9 +665,14 @@ initlibevwrapper(void) if (PyModule_AddObject(module, "Timer", (PyObject *)&libevwrapper_TimerType) == -1) INITERROR; +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 7 + // Since CPython 3.7, `Py_Initialize()` routing always initializes GIL. + // Routine `PyEval_ThreadsInitialized()` has been deprecated in CPython 3.7 + // and completely removed in CPython 3.13. if (!PyEval_ThreadsInitialized()) { PyEval_InitThreads(); } +#endif #if PY_MAJOR_VERSION >= 3 return module;