aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/libshiboken/threadstatesaver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sources/shiboken2/libshiboken/threadstatesaver.cpp')
-rw-r--r--sources/shiboken2/libshiboken/threadstatesaver.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/sources/shiboken2/libshiboken/threadstatesaver.cpp b/sources/shiboken2/libshiboken/threadstatesaver.cpp
index 0d19528f9..085535fd7 100644
--- a/sources/shiboken2/libshiboken/threadstatesaver.cpp
+++ b/sources/shiboken2/libshiboken/threadstatesaver.cpp
@@ -51,7 +51,11 @@ ThreadStateSaver::~ThreadStateSaver()
void ThreadStateSaver::save()
{
+#if PY_VERSION_HEX >= 0x0309000
+ if (Py_IsInitialized())
+#else
if (PyEval_ThreadsInitialized())
+#endif
m_threadState = PyEval_SaveThread();
}