Skip to content
Snippets Groups Projects
Commit 0ee6dedb authored by Studer Gabriel's avatar Studer Gabriel
Browse files

resolve segfault in dng observed with Python 3.9

Calling the PythonInterpreter constructor set up some Python objects via
Boost Python before Python was properly initialized. This caused a segfault
in _PyObject_GC_Malloc in Python. Not sure what finally triggered that
segfault. Different Boost version? Different Python version? Different
compiler? Bruce Lee beating up Chuck Norris? https://youtu.be/HFm2L03AetU
parent 272d57f8
No related branches found
No related tags found
No related merge requests found
......@@ -66,6 +66,9 @@ PythonInterpreter::~PythonInterpreter()
PythonInterpreter& PythonInterpreter::Instance()
{
if(!Py_IsInitialized()){
Py_InitializeEx(1);
}
static PythonInterpreter instance;
return instance;
}
......
......@@ -20,6 +20,7 @@
#include "python_interpreter_worker.hh"
#include "python_interpreter.hh"
#include <iostream>
namespace ost { namespace gui {
......@@ -55,7 +56,6 @@ PythonInterpreterWorker::PythonInterpreterWorker():
current_id_(),
awake_(false)
{
Py_InitializeEx(1);
parse_expr_cmd_=bp::import("parser").attr("expr");
main_namespace_ = bp::extract<bp::dict>(bp::import("__main__").attr("__dict__"));
repr_=bp::import("__main__").attr("__builtins__").attr("repr");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment