Commit 9e24f51a authored by Ben Boeckel's avatar Ben Boeckel
Browse files

Merge topic 'void-swig-ptr' into release-6.3

* void-swig-ptr:
  BUG 16054: Reduce chance of mistaken swig pointer string.
parents cbcf09a8 66c211a7
...@@ -227,24 +227,20 @@ static bool vtkPythonGetValue( ...@@ -227,24 +227,20 @@ static bool vtkPythonGetValue(
reinterpret_cast<char *>(p), &s, "p_void"); reinterpret_cast<char *>(p), &s, "p_void");
#ifdef VTK_PY3K #ifdef VTK_PY3K
Py_DECREF(bytes); Py_DECREF(bytes);
#endif if (s != 0)
if (s >= 0)
{ {
return true; PyErr_SetString(PyExc_TypeError, "requires a _addr_p_void string");
}
if (s == -1)
{
char buf[128];
sprintf(buf, "value is %.80s, required type is p_void",
reinterpret_cast<char *>(p));
PyErr_SetString(PyExc_TypeError, buf);
return false; return false;
} }
else #else
if (s == -1)
{ {
PyErr_SetString(PyExc_TypeError, "cannot get a void pointer"); // matched _addr_ but not p_void, assume it isn't a swig ptr string:
return false; // use the buffer's pointer as the argument
a = p;
} }
#endif
return true;
} }
else if (p && sz >= 0) else if (p && sz >= 0)
{ {
......
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