◐ Shell
clean mode source ↗

Message 292637 - Python tracker

Is there any reason that the second case Terry provide still will failed with ValueError?

class C:
    def meth2(**kwds): pass


ip.signature(C().meth2)

Traceback (most recent call last):
  File "/home/linux/Python/cpython/Lib/idlelib/idle_test/test_calltips.py", line 139, in test_starred_parameter
    self.assertEqual(signature(meth), mtip)
  File "/home/linux/Python/cpython/Lib/idlelib/calltips.py", line 149, in get_argspec
    argspec = str(inspect.signature(fob))
  File "/home/linux/Python/cpython/Lib/inspect.py", line 3028, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "/home/linux/Python/cpython/Lib/inspect.py", line 2778, in from_callable
    follow_wrapper_chains=follow_wrapped)
  File "/home/linux/Python/cpython/Lib/inspect.py", line 2195, in _signature_from_callable
    return _signature_bound_method(sig)
  File "/home/linux/Python/cpython/Lib/inspect.py", line 1785, in _signature_bound_method
    raise ValueError('invalid method signature')
ValueError: invalid method signature