[C++-sig] error while formatting signature for <wrapped_class> arg is not a Python function

troy d. straszheim troy at resophonic.com
Mon Aug 18 17:07:45 CEST 2008


David Abrahams wrote:
> on Sat Aug 16 2008, "troy d. straszheim" <troy-AT-resophonic.com> wrote:
> 
>> I'm playing with Sphinx 0.4.3, trying to make some docs for wrapped classes.
>> I'm getting the error
>>
>>   error while formatting signature for <wrapped_class> arg is not a Python function
>>
>> where 'arg is not a Python function' is the TypeError you get when you call
>> inspect.getargspec() of a wrapped member function.
>> Appears to relate to this thread about doctests:
>>
>>   http://mail.python.org/pipermail/c++-sig/2007-June/012481.html
>>
>> Has anybody looked further at this?
> 
> I'm afraid I never did look at it further.  I'd be very happy if the
> the problem were solved, though :-)
> 

This has recently been worked around / fixed on the trunk of sphinx.  No more big red
boxes in the generated html.  Yay.  Sphinx is some Really Good Stuff.

I did spend some time hacking at this, and at this point am not sure there
exists a problem on the boost.python side.   The behavior of
inspect.getargspec() is the same for builtin C functions that come packaged
with python as for boost.python wrapped functions.  Take the standard C
package 'audioop':

 >>> import audioop, inspect
 >>> def f(x): pass
...
 >>> inspect.getargspec(f)
(['x'], None, None, None)
 >>> inspect.getargspec(audioop.bias)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File "/usr/lib/python2.5/inspect.py", line 742, in getargspec
     raise TypeError('arg is not a Python function')
TypeError: arg is not a Python function

So apparently when getargspec says 'not a Python function' it does mean
'Python' and not just 'function'.

I don't know how this impacts the doctest stuff in the post mentioned above.
Anyway, I have to get back to writing docs....

-t



More information about the Cplusplus-sig mailing list