[C++-sig] Re: function::argument_error / overloads & docstrings
nickm at sitius.com
Mon Nov 3 15:46:30 CET 2003
David Abrahams wrote:
> Nikolay Mladenov <nickm at sitius.com> writes:
> > I had to change function::argument_error because it was throwing
> > exception (MSVC6.5 built)
> Nikolay, I'm confused. The whole point of argument_error is to throw
> an exception.
Yes, but the current cvs code causes an exception to be thrown from line
266 of function.cpp and
this exception is completely unrelated to the argument error, it was
"no converter to_python found for C++ type char", instead of "no match
found for C++ signatures ...".
I suspect this only happens on MSVC.
The first patch in my post fixes that.
The second patch I posted beautifies the signatures so they include the
arg names and the default values.
May be the names aren't so important in this case I think that it is
good to have the default values.
Than another thing I thought is that list of those pretty signatures
can be used to generate nicer docstrings
when there are overloaded functions. As it is now one cannot provide
separate docstrings for the different overloads
and on top of that the signatures of the functions are not shown when
documentation is generated.
so I thought that
static PyObject* function_get_doc(PyObject* op, void*)
can be modified to return something like (loosely speaking):
f->pretty_signature() + f->doc() + "\n"+ get_doc(f->m_overload)
More information about the Cplusplus-sig