Rex Dieter 09c353
Index: b/kpythonpluginfactory/kpythonpluginfactory.cpp
Rex Dieter 09c353
===================================================================
Rex Dieter 09c353
--- a/kpythonpluginfactory/kpythonpluginfactory.cpp
Rex Dieter 09c353
+++ b/kpythonpluginfactory/kpythonpluginfactory.cpp
Rex Dieter 09c353
@@ -33,6 +33,12 @@
Rex Dieter 09c353
 #define PY3
Rex Dieter 09c353
 #endif
Rex Dieter 09c353
 
Rex Dieter 09c353
+#if PY_MAJOR_VERSION >= 3
Rex Dieter 09c353
+#if PY_MINOR_VERSION >= 2
Rex Dieter 09c353
+#define PY3.2
Rex Dieter 09c353
+#endif
Rex Dieter 09c353
+#endif
Rex Dieter 09c353
+
Rex Dieter 09c353
 /*
Rex Dieter 09c353
 This implements a plugin factory for running Python plugins. It also
Rex Dieter 09c353
 supports io-slaves with a kdemain() entry point.
Rex Dieter 09c353
@@ -106,8 +112,13 @@ void KPythonPluginFactory::initialize()
Rex Dieter 09c353
         kDebug() << "Initializing Python interpreter.";
Rex Dieter 09c353
         pythonLib = LoadPythonLibrary();
Rex Dieter 09c353
 
Rex Dieter 09c353
+#ifdef PY3.2
Rex Dieter 09c353
+        Py_Initialize ();
Rex Dieter 09c353
+        PyEval_InitThreads ();
Rex Dieter 09c353
+#else
Rex Dieter 09c353
         PyEval_InitThreads ();
Rex Dieter 09c353
         Py_Initialize ();
Rex Dieter 09c353
+#endif
Rex Dieter 09c353
         if (!Py_IsInitialized ())
Rex Dieter 09c353
         {
Rex Dieter 09c353
             //pythonInit = 0;
Rex Dieter 09c353
@@ -117,8 +128,10 @@ void KPythonPluginFactory::initialize()
Rex Dieter 09c353
         kDebug() << "Succesfully initialized Python interpreter.";
Rex Dieter 09c353
 
Rex Dieter 09c353
         threadState = PyThreadState_GET();
Rex Dieter 09c353
+#ifndef PY3.2
Rex Dieter 09c353
         // free the lock
Rex Dieter 09c353
         PyEval_ReleaseLock();
Rex Dieter 09c353
+#endif
Rex Dieter 09c353
     }
Rex Dieter 09c353
 }
Rex Dieter 09c353