Commit 7ca26385 authored by David C. Lonie's avatar David C. Lonie
Browse files

Disable python signal handlers in matplotlib module.

Change-Id: I891ef3ffa16aef481feb32949c78b2a9b113e9b2
parent 945cf14e
......@@ -164,7 +164,7 @@ vtkMatplotlibMathTextUtilities* vtkMatplotlibMathTextUtilities::New()
vtkMplStartUpDebugMacro("Initializing python. (if there is a segfault "
"and error 'ImportError: No module named site',"
" VTK_MATPLOTLIB_PYTHONHOME is incorrect).");
Py_Initialize();
Py_InitializeEx(0);
}
if (!Py_IsInitialized())
......@@ -175,6 +175,13 @@ vtkMatplotlibMathTextUtilities* vtkMatplotlibMathTextUtilities::New()
return NULL;
}
// The call to Py_InitializeEx(0) should disable signal handlers, but
// for some reason SIGINT is still handled (and ignored) by the threading
// module. This works around that issue.
vtkMplStartUpDebugMacro("Disabling interrupt signal handlers.");
PyRun_SimpleString("import signal;"
"signal.signal(signal.SIGINT, signal.SIG_DFL);");
vtkMplStartUpDebugMacro("Python environment initialized. Checking "
"VTK_MATPLOTLIB_PYTHONPATH.");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment