summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2023-01-25 22:34:28 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2023-01-25 23:36:05 +0900
commite0c6c2a79a668437e9c15b9e193742babeb9b8fa (patch)
treead12455a5e8d088add5ab3dd990067eb85786abe
parente55e706f31de58a8286d0b6e53b723d9d199d5c6 (diff)
downloadpytdeextensions-e0c6c2a7.tar.gz
pytdeextensions-e0c6c2a7.zip
Fix initialization of the python interpreter. This was causing runtime SEGV in tde-guidance
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r--src/pythonize.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/pythonize.cpp b/src/pythonize.cpp
index d8fb038..9d41f69 100644
--- a/src/pythonize.cpp
+++ b/src/pythonize.cpp
@@ -42,8 +42,12 @@ Pythonize::Pythonize ()
if (!Py_IsInitialized ())
{
- PyEval_InitThreads ();
- Py_Initialize ();
+ Py_Initialize();
+
+#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 6
+ // initialize thread support
+ PyEval_InitThreads();
+#endif
if (!Py_IsInitialized ())
{
pythonInit = 0;
@@ -51,9 +55,6 @@ Pythonize::Pythonize ()
}
if (debug) printf ("Python interpreter initialized!\n\n");
-
- // free the lock
- PyEval_ReleaseLock();
}
}