1 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/CMakeLists.txt ParaView-4.1.0_SRC-new/CMakeLists.txt
2 --- ParaView-4.1.0_SRC-orig/CMakeLists.txt 2014-01-11 17:59:57.000000000 +0400
3 +++ ParaView-4.1.0_SRC-new/CMakeLists.txt 2014-05-05 12:30:42.000000000 +0400
6 #----------------------------------------------------------------------------------
7 # Set some flags that affect VTK's modules.
8 - set (VTK_NO_PYTHON_THREADS 1 CACHE INTERNAL
9 + set (VTK_NO_PYTHON_THREADS OFF CACHE INTERNAL
10 "Disable Python Threads support" FORCE)
11 set(VTK_WRAP_PYTHON ${PARAVIEW_ENABLE_PYTHON}
12 CACHE INTERNAL "Should VTK Python wrapping be built?" FORCE)
13 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx ParaView-4.1.0_SRC-new/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx
14 --- ParaView-4.1.0_SRC-orig/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx 2014-01-11 17:59:57.000000000 +0400
15 +++ ParaView-4.1.0_SRC-new/ParaViewCore/ServerManager/Rendering/vtkSMPVRepresentationProxy.cxx 2014-05-05 12:30:57.000000000 +0400
20 - vtkWarningMacro("Could not determine array range.");
21 + // vtkWarningMacro("Could not determine array range.");
25 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/ParaViewCore/VTKExtensions/Default/vtkPVImageReader.h ParaView-4.1.0_SRC-new/ParaViewCore/VTKExtensions/Default/vtkPVImageReader.h
26 --- ParaView-4.1.0_SRC-orig/ParaViewCore/VTKExtensions/Default/vtkPVImageReader.h 2014-01-11 17:59:57.000000000 +0400
27 +++ ParaView-4.1.0_SRC-new/ParaViewCore/VTKExtensions/Default/vtkPVImageReader.h 2014-05-05 12:30:42.000000000 +0400
30 #include "vtkPVVTKExtensionsDefaultModule.h" //needed for exports
32 -#ifdef PARAVIEW_USE_MPI
33 -#include "vtkMPIImageReader.h"
35 #include "vtkImageReader.h"
38 -class VTKPVVTKEXTENSIONSDEFAULT_EXPORT vtkPVImageReader : public
39 -#ifdef PARAVIEW_USE_MPI
44 +class VTKPVVTKEXTENSIONSDEFAULT_EXPORT vtkPVImageReader : public vtkImageReader
47 static vtkPVImageReader* New();
49 -#ifdef PARAVIEW_USE_MPI
50 - vtkTypeMacro(vtkPVImageReader, vtkMPIImageReader);
53 vtkTypeMacro(vtkPVImageReader, vtkImageReader);
56 void PrintSelf(ostream& os, vtkIndent indent);
58 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/Qt/Python/pqPythonManager.cxx ParaView-4.1.0_SRC-new/Qt/Python/pqPythonManager.cxx
59 --- ParaView-4.1.0_SRC-orig/Qt/Python/pqPythonManager.cxx 2014-01-11 18:00:00.000000000 +0400
60 +++ ParaView-4.1.0_SRC-new/Qt/Python/pqPythonManager.cxx 2014-05-05 12:30:42.000000000 +0400
62 // initialized (by a startup plugin, for example)
63 if (vtkPythonInterpreter::IsInitialized())
65 - importParaViewModule();
66 + //importParaViewModule();
70 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/VTK/Common/Core/vtkCharArray.h ParaView-4.1.0_SRC-new/VTK/Common/Core/vtkCharArray.h
71 --- ParaView-4.1.0_SRC-orig/VTK/Common/Core/vtkCharArray.h 2014-01-11 18:02:05.000000000 +0400
72 +++ ParaView-4.1.0_SRC-new/VTK/Common/Core/vtkCharArray.h 2014-05-05 12:30:42.000000000 +0400
74 // make up the interface of vtkDataArrayTemplate, which is ignored
77 - vtkCreateWrappedArrayInterface(char);
78 +// vtkCreateWrappedArrayInterface(char);
80 + // [ABN] manual macro expansion to avoid the last 4 methods (they were BTX/ETX enclosed in
81 + // prev versions of PV, meaning not included in the wrapping).
83 + void GetTupleValue(vtkIdType i, char* tuple);
84 + void SetTupleValue(vtkIdType i, const char* tuple);
85 + void InsertTupleValue(vtkIdType i, const char* tuple);
86 + vtkIdType InsertNextTupleValue(const char* tuple);
87 + char GetValue(vtkIdType id);
88 + void SetValue(vtkIdType id, char value);
89 + void SetNumberOfValues(vtkIdType number);
90 + void InsertValue(vtkIdType id, char f);
91 + vtkIdType InsertNextValue(char f);
93 +// T *GetValueRange(int comp);
94 +// T *GetValueRange();
95 +// T* WritePointer(vtkIdType id, vtkIdType number);
96 +// T* GetPointer(vtkIdType id);
101 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/VTK/Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx ParaView-4.1.0_SRC-new/VTK/Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx
102 --- ParaView-4.1.0_SRC-orig/VTK/Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx 2014-01-11 18:02:10.000000000 +0400
103 +++ ParaView-4.1.0_SRC-new/VTK/Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx 2014-05-05 12:30:42.000000000 +0400
105 //----------------------------------------------------------------------------
106 vtkMatplotlibMathTextUtilities::Availablity
107 vtkMatplotlibMathTextUtilities::MPLMathTextAvailable =
108 -vtkMatplotlibMathTextUtilities::NOT_TESTED;
109 +vtkMatplotlibMathTextUtilities::UNAVAILABLE;
111 // A macro that is used in New() to print warnings if VTK_MATPLOTLIB_DEBUG
112 // is defined in the environment. Use vtkGenericWarningMacro to allow this to
113 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/VTK/Utilities/Python/vtkPython.h ParaView-4.1.0_SRC-new/VTK/Utilities/Python/vtkPython.h
114 --- ParaView-4.1.0_SRC-orig/VTK/Utilities/Python/vtkPython.h 2014-01-11 18:02:13.000000000 +0400
115 +++ ParaView-4.1.0_SRC-new/VTK/Utilities/Python/vtkPython.h 2014-05-05 12:30:42.000000000 +0400
117 #error "Python.h is different version from what VTK was configured with!!"
120 +#ifdef VTK_NO_PYTHON_THREADS
121 +# define VTK_PY_GIL_ENSURE
122 +# define VTK_PY_GIL_RELEASE
124 +# define VTK_PY_GIL_ENSURE PyGILState_STATE _gstate_avoid_clash = PyGILState_Ensure();
125 +# define VTK_PY_GIL_RELEASE PyGILState_Release(_gstate_avoid_clash);
131 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx ParaView-4.1.0_SRC-new/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx
132 --- ParaView-4.1.0_SRC-orig/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx 2014-01-11 18:02:13.000000000 +0400
133 +++ ParaView-4.1.0_SRC-new/VTK/Utilities/PythonInterpreter/vtkPythonInteractiveInterpreter.cxx 2014-05-05 12:30:42.000000000 +0400
136 void CleanupPythonObjects()
139 Py_XDECREF(this->InteractiveConsoleLocals);
140 Py_XDECREF(this->InteractiveConsole);
141 this->InteractiveConsole = NULL;
143 const char* code = "import gc; gc.collect()\n";
144 vtkPythonInterpreter::RunSimpleString(code);
149 PyObject* GetInteractiveConsole()
152 vtkPythonInterpreter::Initialize();
155 // set up the code.InteractiveConsole instance that we'll use.
156 const char* code = "import code\n"
157 "__vtkConsoleLocals={'__name__':'__vtkconsole__','__doc__':None}\n"
160 vtkGenericWarningMacro(
161 "Failed to locate the InteractiveConsole/InteractiveConsoleLocals object.");
165 Py_INCREF(this->InteractiveConsole);
167 PySys_SetObject(const_cast<char*>("ps2"), ps2 = PyString_FromString("... "));
172 return this->InteractiveConsole;
180 bool ret_value = false;
181 PyObject *res = PyObject_CallMethod(console,
182 const_cast<char*>("push"), const_cast<char*>("z"), buffer.c_str());
191 @@ -190,12 +196,14 @@
193 this->Internals->GetInteractiveConsole(); //ensure the console is initialized
196 PyObject* context = this->Internals->GetInteractiveConsoleLocalsPyObject();
197 PyObject* result = PyRun_String(const_cast<char*>(script), Py_file_input, context, context);
214 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx ParaView-4.1.0_SRC-new/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx
215 --- ParaView-4.1.0_SRC-orig/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx 2014-01-11 18:02:13.000000000 +0400
216 +++ ParaView-4.1.0_SRC-new/VTK/Utilities/PythonInterpreter/vtkPythonInterpreter.cxx 2014-05-05 12:30:42.000000000 +0400
219 inline void vtkPrependPythonPath(const char* pathtoadd)
222 PyObject* path = PySys_GetObject(const_cast<char*>("path"));
223 PyObject* newpath = PyString_FromString(pathtoadd);
224 PyList_Insert(path, 0, newpath);
231 //----------------------------------------------------------------------------
232 bool vtkPythonInterpreter::Initialize(int initsigs /*=0*/)
234 - vtkPythonInterpreter::InitializedOnce = true;
235 if (Py_IsInitialized() == 0)
237 #if (VTK_PYTHON_MAJOR_VERSION > 2) ||\
238 @@ -117,11 +118,24 @@
244 // Put default SIGINT handler back after Py_Initialize/Py_InitializeEx.
245 signal(SIGINT, SIG_DFL);
249 + if (! vtkPythonInterpreter::InitializedOnce)
251 +#ifndef VTK_NO_PYTHON_THREADS
252 + PyEval_InitThreads(); // safe to call this multiple time
254 + // At this point we have GIL, or we are mono-thread.
255 + // Access to the static below is safe:
256 + vtkPythonInterpreter::InitializedOnce = true;
258 +#ifndef VTK_NO_PYTHON_THREADS
259 + PyEval_ReleaseLock(); // release GIL
261 // HACK: Calling PyRun_SimpleString for the first time for some reason results in
262 // a "\n" message being generated which is causing the error dialog to
263 // popup. So we flush that message out of the system before setting up the
264 @@ -134,15 +148,17 @@
265 vtkPythonStdStreamCaptureHelper* wrapperErr =
266 NewPythonStdStreamCaptureHelper(true);
268 - // Redirect Python's stdout and stderr and stdin
269 - PySys_SetObject(const_cast<char*>("stdout"),
270 + // Redirect Python's stdout and stderr and stdin - GIL protected operation
272 + int ret1 = PySys_SetObject(const_cast<char*>("stdout"),
273 reinterpret_cast<PyObject*>(wrapperOut));
274 - PySys_SetObject(const_cast<char*>("stderr"),
275 + int ret2 = PySys_SetObject(const_cast<char*>("stderr"),
276 reinterpret_cast<PyObject*>(wrapperErr));
277 - PySys_SetObject(const_cast<char*>("stdin"),
278 + int ret3 = PySys_SetObject(const_cast<char*>("stdin"),
279 reinterpret_cast<PyObject*>(wrapperOut));
280 Py_DECREF(wrapperOut);
281 Py_DECREF(wrapperErr);
284 for (size_t cc=0; cc < PythonPaths.size(); cc++)
289 //----------------------------------------------------------------------------
290 +// [ABN] not thread safe for now - only used by pvpython?
291 int vtkPythonInterpreter::PyMain(int argc, char** argv)
293 if (!vtkPythonInterpreter::InitializedOnce && Py_IsInitialized() == 0 &&
295 buffer.erase(std::remove(buffer.begin(), buffer.end(), '\r'), buffer.end());
297 // The cast is necessary because PyRun_SimpleString() hasn't always been const-correct
299 PyRun_SimpleString(const_cast<char*>(buffer.c_str()));
303 //----------------------------------------------------------------------------
304 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx ParaView-4.1.0_SRC-new/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx
305 --- ParaView-4.1.0_SRC-orig/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx 2014-01-11 18:02:14.000000000 +0400
306 +++ ParaView-4.1.0_SRC-new/VTK/Wrapping/PythonCore/vtkPythonCommand.cxx 2014-05-05 12:30:42.000000000 +0400
308 vtkPythonUtil::UnRegisterPythonCommand(this);
309 if (this->obj && Py_IsInitialized())
312 Py_DECREF(this->obj);
318 void vtkPythonCommand::SetObject(PyObject *o)
327 // If a threadstate has been set using vtkPythonCommand::SetThreadState,
328 // then swap it in here. See the email to vtk-developers@vtk.org from
329 // June 18, 2009 with subject "Py_NewInterpreter and vtkPythonCallback issue"
330 - PyThreadState* prevThreadState = NULL;
331 - if (this->ThreadState)
333 - prevThreadState = PyThreadState_Swap(this->ThreadState);
335 +// PyThreadState* prevThreadState = NULL;
336 +// if (this->ThreadState)
338 +// prevThreadState = PyThreadState_Swap(this->ThreadState);
341 if (ptr && ptr->GetReferenceCount() > 0)
343 @@ -176,10 +180,10 @@
346 // If we did the swap near the top of this function then swap back now.
347 - if (this->ThreadState)
349 - PyThreadState_Swap(prevThreadState);
351 +// if (this->ThreadState)
353 +// PyThreadState_Swap(prevThreadState);
356 #ifndef VTK_NO_PYTHON_THREADS
357 #if (PY_MAJOR_VERSION > 2) || \
358 diff -Naur --exclude=CVS ParaView-4.1.0_SRC-orig/Wrapping/Python/paraview/servermanager.py ParaView-4.1.0_SRC-new/Wrapping/Python/paraview/servermanager.py
359 --- ParaView-4.1.0_SRC-orig/Wrapping/Python/paraview/servermanager.py 2014-01-11 18:00:00.000000000 +0400
360 +++ ParaView-4.1.0_SRC-new/Wrapping/Python/paraview/servermanager.py 2014-05-05 12:30:57.000000000 +0400
361 @@ -1095,7 +1095,7 @@
362 property = self.SMProperty
363 nElems = property.GetNumberOfElements()
365 - raise ValueError, "The SMProperty with XML label '%s' has a size that is not a multiple of 2." % property.GetXMLLabel()
368 for i in range(0, nElems, 2):
369 if self.GetElement(i+1) != '0':