Short explanation:
In Python, instead of the scarcely helpful error message
NotImplementedError: No matching function for
overloaded 'Foo_setCoord'
NotImplementedError: Wrong number of arguments for
overloaded function 'Foo_setCoord'.
Possible prototypes are:
self.setCoord(int,int) # Foo *self,int x,int y
self.setCoord(int) # Foo *self,int x
Long explanation:
Currently, if you wrap the following class
class Foo {
private:
int X, Y;
public:
Foo(int id);
Foo(const char *name);
void setCoord(int x, int y);
void setCoord(int x);
};
and you say
f = Foo( 1, 2 )
the dispatcher function generates this error message:
NotImplementedError: No matching function for
overloaded 'new_Foo'
This is hardly helpful. With this patch you get:
NotImplementedError: Wrong number of arguments for
overloaded function 'new_Foo'.
Possible prototypes are:
Foo(int) # int id
Foo(char const *) # char const *name
Similarly, if you say
f.setCoord( 1, 2, 3)
you currently get
NotImplementedError: No matching function for
overloaded 'Foo_setCoord'
whereas
NotImplementedError: Wrong number of arguments for
overloaded function 'Foo_setCoord'.
Possible prototypes are:
self.setCoord(int,int) # Foo *self,int x,int y
self.setCoord(int) # Foo *self,int x
might help users of the extension module more.
Note that this patch only applies to a wrong number of
arguments. For the other case (correct number of
arguments, but at least one of them is of a wrong type)
the error message is already very detailed and helpful.
Logged In: YES
user_id=1259995
With the latest patch the output has less redundancy, and
also includes the return type.
NotImplementedError: Wrong number of arguments for
overloaded function 'setCoord'.
Possible prototypes are:
void Foo.setCoord(int,int) # self, x, y
void Foo.setCoord(int) # self, x
This version splits the string over multiple lines, as some
compilers (notably MSVC) impose a maximum on the source code
line length.
small patch against python.cxx,v 1.203