uber/doubles

Doubled methods signature can't be inspected

charlax opened this issue · 0 comments

Trying to inspect.signature a double method raises the following (shortened traceback):

  File "my_code/base.py", line 279, in func
    inspect.signature(f).parameters
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/inspect.py", line 3037, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/inspect.py", line 2787, in from_callable
    follow_wrapper_chains=follow_wrapped)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/inspect.py", line 2266, in _signature_from_callable
    skip_bound_arg=skip_bound_arg)
  File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/inspect.py", line 2090, in _signature_from_builtin
    raise ValueError("no signature found for builtin {!r}".format(func))
ValueError: no signature found for builtin <doubles.proxy_method.ProxyMethod object at 0x115fe8240>

Should be fairly easy to fix since the PEP allows signature to be provided via __wrapped__ or __signature__.

Will provide a PR to fix this.