This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: inspect.signature() doesn't support partialmethod without explicit self parameter
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.7, Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: corona10, ncoghlan, rhettinger, serhiy.storchaka, yselivanov
Priority: normal Keywords:

Created on 2017-04-23 20:18 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 1308 merged corona10, 2017-04-26 17:52
PR 1662 merged corona10, 2017-05-19 02:17
PR 1663 merged corona10, 2017-05-19 02:17
Messages (5)
msg292184 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-04-23 20:18
>>> 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'
msg292380 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2017-04-26 17:53
I submitted the PR for this issue.
msg293877 - (view) Author: Yury Selivanov (yselivanov) * (Python committer) Date: 2017-05-17 19:00
New changeset 378d70642aa1c8de2a53ecb811927faf0388db2d by Yury Selivanov (Dong-hee Na) in branch 'master':
bpo-30149: Fix partialmethod without explicit self parameter (#1308)
https://github.com/python/cpython/commit/378d70642aa1c8de2a53ecb811927faf0388db2d
msg296101 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-06-15 14:42
New changeset e45ea377b8d9ae23893d4587003c6d3e7f54b99a by Serhiy Storchaka (Dong-hee Na) in branch '3.6':
bpo-30149: Fix partialmethod without explicit self parameter (#1308) (#1662)
https://github.com/python/cpython/commit/e45ea377b8d9ae23893d4587003c6d3e7f54b99a
msg296102 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-06-15 14:42
New changeset fb0825c2784f80689c4c00c3ede22958faaf512c by Serhiy Storchaka (Dong-hee Na) in branch '3.5':
bpo-30149: Fix partialmethod without explicit self parameter (#1308) (#1663)
https://github.com/python/cpython/commit/fb0825c2784f80689c4c00c3ede22958faaf512c
History
Date User Action Args
2022-04-11 14:58:45adminsetgithub: 74335
2017-06-15 14:44:19serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: resolved
2017-06-15 14:42:03serhiy.storchakasetmessages: + msg296102
2017-06-15 14:42:01serhiy.storchakasetmessages: + msg296101
2017-05-19 02:17:49corona10setpull_requests: + pull_request1758
2017-05-19 02:17:12corona10setpull_requests: + pull_request1757
2017-05-17 19:00:54yselivanovsetmessages: + msg293877
2017-04-26 17:53:39corona10setnosy: + corona10
messages: + msg292380
2017-04-26 17:52:58corona10setpull_requests: + pull_request1415
2017-04-23 20:18:25serhiy.storchakacreate