Ticket #47125: kubuntu_kpythonpluginfactory_3.2support.diff

File kubuntu_kpythonpluginfactory_3.2support.diff, 1.1 KB (added by RJVB (René Bertin), 10 years ago)
  • kpythonpluginfactory/kpythonpluginfactory.cpp

    old new  
    3333#define PY3
    3434#endif
    3535
     36#if PY_MAJOR_VERSION >= 3
     37#if PY_MINOR_VERSION >= 2
     38#define PY3.2
     39#endif
     40#endif
     41
    3642/*
    3743This implements a plugin factory for running Python plugins. It also
    3844supports io-slaves with a kdemain() entry point.
    void KPythonPluginFactory::initialize() 
    106112        kDebug() << "Initializing Python interpreter.";
    107113        pythonLib = LoadPythonLibrary();
    108114
     115#ifdef PY3.2
     116        Py_Initialize ();
     117        PyEval_InitThreads ();
     118#else
    109119        PyEval_InitThreads ();
    110120        Py_Initialize ();
     121#endif
    111122        if (!Py_IsInitialized ())
    112123        {
    113124            //pythonInit = 0;
    void KPythonPluginFactory::initialize() 
    117128        kDebug() << "Succesfully initialized Python interpreter.";
    118129
    119130        threadState = PyThreadState_GET();
     131#ifndef PY3.2
    120132        // free the lock
    121133        PyEval_ReleaseLock();
     134#endif
    122135    }
    123136}
    124137