mirror of https://github.com/Icinga/icinga2.git
Python build fix.
This commit is contained in:
parent
34d6b42b38
commit
b9ded4a851
|
@ -74,8 +74,7 @@ void PythonInterpreter::UnregisterPythonFunction(const String& name)
|
||||||
m_Functions.erase(name);
|
m_Functions.erase(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PythonInterpreter::ProcessCall(const ScriptTask::Ptr& task, const String& function,
|
Value PythonInterpreter::ProcessCall(const String& function, const std::vector<Value>& arguments)
|
||||||
const std::vector<Value>& arguments)
|
|
||||||
{
|
{
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
|
|
||||||
|
@ -120,11 +119,14 @@ void PythonInterpreter::ProcessCall(const ScriptTask::Ptr& task, const String& f
|
||||||
Value vresult = PythonLanguage::MarshalFromPython(result);
|
Value vresult = PythonLanguage::MarshalFromPython(result);
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
|
|
||||||
task->FinishResult(vresult);
|
m_Language->SetCurrentInterpreter(interp);
|
||||||
} catch (...) {
|
PyEval_ReleaseThread(m_ThreadState);
|
||||||
task->FinishException(boost::current_exception());
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Language->SetCurrentInterpreter(interp);
|
return vresult;
|
||||||
PyEval_ReleaseThread(m_ThreadState);
|
} catch (...) {
|
||||||
|
m_Language->SetCurrentInterpreter(interp);
|
||||||
|
PyEval_ReleaseThread(m_ThreadState);
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,7 @@ protected:
|
||||||
PyThreadState *m_ThreadState;
|
PyThreadState *m_ThreadState;
|
||||||
std::map<String, PyObject *> m_Functions;
|
std::map<String, PyObject *> m_Functions;
|
||||||
|
|
||||||
virtual void ProcessCall(const ScriptTask::Ptr& task, const String& function,
|
virtual Value ProcessCall(const String& function, const std::vector<Value>& arguments);
|
||||||
const std::vector<Value>& arguments);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "python/pythonlanguage.h"
|
#include "python/pythonlanguage.h"
|
||||||
#include "python/pythoninterpreter.h"
|
#include "python/pythoninterpreter.h"
|
||||||
|
#include "base/scriptfunction.h"
|
||||||
#include "base/dynamictype.h"
|
#include "base/dynamictype.h"
|
||||||
#include "base/objectlock.h"
|
#include "base/objectlock.h"
|
||||||
#include "base/application.h"
|
#include "base/application.h"
|
||||||
|
@ -320,9 +321,7 @@ PyObject *PythonLanguage::PyCallNativeFunction(PyObject *self, PyObject *args)
|
||||||
Value result;
|
Value result;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ScriptTask::Ptr task = boost::make_shared<ScriptTask>(function, arguments);
|
result = function->Invoke(arguments);
|
||||||
task->Start();
|
|
||||||
result = task->GetResult();
|
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
PyEval_RestoreThread(tstate);
|
PyEval_RestoreThread(tstate);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue