Commit 0aeadcc1 authored by David Gobbi's avatar David Gobbi Committed by Marcus D. Hanwell
Browse files

ENH: Don't check array size when resolving overloads in python wrappers.

The semantics for finding the right overload in the python wrappers
should match C++ semantics.  That means that array are matched based
only on the type, not on the size of the array.
parent 15c2205a
......@@ -1681,27 +1681,30 @@ PyObject *PyVTKCallOverloadedMethod(const char *name, PyMethodDef *methods,
}
else
{
// Note: we don't reject the method if the sequence count
// doesn't match. If that circumstance occurs, we want the
// method to be called with an incorrect count so that a
// useful error will be reported to the user. Also, we want
// to mimic C++ semantics, and C++ doesn't care about the
// size of arrays when it resolves overloads.
int m = PySequence_Size(arg);
for (int j = 0; j < m; j++)
for (int j = 0;; j++)
{
if (!helper->next(&format, &classname) || *format == ')')
if (!helper->next(&format, &classname))
{
helper->priority(-1);
break;
}
PyObject *sarg = PySequence_GetItem(arg, j);
if (helper->priority(PyVTKCheckArg(sarg, format, classname))
< 0)
if (*format == ')')
{
break;
}
}
if (!helper->next(&format, &classname) ||
*format != ')')
{
helper->priority(-1);
if (j < m)
{
PyObject *sarg = PySequence_GetItem(arg, j);
helper->priority(PyVTKCheckArg(sarg, format, classname));
}
}
}
}
......
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