Commit 42761bdf authored by Prabhu Ramachandran's avatar Prabhu Ramachandran
Browse files

BUG: Chris Kruszynski posted a test case and a fix for a problem where

the Python interpreter would crash on exit.  This has been applied.
Thanks Chris!  More details here:
http://public.kitware.com/pipermail/vtk-developers/2008-August/005418.html
parent e7ee1bbe
......@@ -7,6 +7,7 @@ IF (VTK_PYTHON_EXE)
TestWeakref
TestNumpySupport
TestTerminationCrash
TestExecuteMethodFinalizeCrash
)
ADD_TEST(${tfile}Python-image ${VTK_PYTHON_EXE}
${VTK_SOURCE_DIR}/Common/Testing/Python/${tfile}.py)
......
"""
Test case for the problem reported, tested and fixed on this post:
http://public.kitware.com/pipermail/vtk-developers/2008-August/005418.html
Without the fix as applied in the patch there, this code should crash on
exit.
"""
import vtk
class TestCase2 :
def __init__(self) :
self.Filter = vtk.vtkProgrammableFilter()
self.Filter.SetExecuteMethod(self.ExecMethod)
def ExecMethod(self) :
print 'execute method called'
test2 = TestCase2()
......@@ -1878,6 +1878,14 @@ void vtkPythonVoidFunc(void *arg)
PyObject *arglist, *result;
PyObject *func = (PyObject *)arg;
// Sometimes it is possible for the function to be invoked after
// Py_Finalize is called, this will cause nasty errors so we return if
// the interpreter is not initialized.
if (Py_IsInitialized() == 0)
{
return;
}
#ifndef VTK_NO_PYTHON_THREADS
#if (PY_MAJOR_VERSION > 2) || \
((PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION >= 3))
......@@ -1917,6 +1925,14 @@ void vtkPythonVoidFuncArgDelete(void *arg)
{
PyObject *func = (PyObject *)arg;
// Sometimes it is possible for the function to be invoked after
// Py_Finalize is called, this will cause nasty errors so we return if
// the interpreter is not initialized.
if (Py_IsInitialized() == 0)
{
return;
}
#ifndef VTK_NO_PYTHON_THREADS
#if (PY_MAJOR_VERSION > 2) || \
((PY_MAJOR_VERSION == 2) && (PY_MINOR_VERSION >= 3))
......
Supports Markdown
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