New submission from Serhiy Storchaka:

>>> import functools, inspect
>>> class A:
...     f = functools.partialmethod((lambda self, x, y, *args: ...), 1)
... 
>>> inspect.signature(A.f)
<Signature (self, y, *args)>
>>> class A:
...     f = functools.partialmethod((lambda *args: ...), 1)
... 
>>> inspect.signature(A.f)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/serhiy/py/cpython/Lib/inspect.py", line 3007, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "/home/serhiy/py/cpython/Lib/inspect.py", line 2757, in from_callable
    follow_wrapper_chains=follow_wrapped)
  File "/home/serhiy/py/cpython/Lib/inspect.py", line 2227, in 
_signature_from_callable
    return sig.replace(parameters=new_params)
  File "/home/serhiy/py/cpython/Lib/inspect.py", line 2780, in replace
    return_annotation=return_annotation)
  File "/home/serhiy/py/cpython/Lib/inspect.py", line 2725, in __init__
    raise ValueError(msg)
ValueError: duplicate parameter name: 'args'

----------
components: Library (Lib)
messages: 292184
nosy: ncoghlan, rhettinger, serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: inspect.signature() doesn't support partialmethod without explicit self 
parameter
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30149>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to