Skip to content
Snippets Groups Projects
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
Branches release-6.3
No related tags found
No related merge requests found
......@@ -227,24 +227,20 @@ static bool vtkPythonGetValue(
reinterpret_cast<char *>(p), &s, "p_void");
#ifdef VTK_PY3K
Py_DECREF(bytes);
#endif
if (s >= 0)
{
return true;
}
if (s == -1)
if (s != 0)
{
char buf[128];
sprintf(buf, "value is %.80s, required type is p_void",
reinterpret_cast<char *>(p));
PyErr_SetString(PyExc_TypeError, buf);
PyErr_SetString(PyExc_TypeError, "requires a _addr_p_void string");
return false;
}
else
#else
if (s == -1)
{
PyErr_SetString(PyExc_TypeError, "cannot get a void pointer");
return false;
// matched _addr_ but not p_void, assume it isn't a swig ptr string:
// use the buffer's pointer as the argument
a = p;
}
#endif
return true;
}
else if (p && sz >= 0)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment