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