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.

Title: inspect.signature isn't aware that types.MethodType can wrap any callable
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.7
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: bup, terry.reedy
Priority: normal Keywords:

Created on 2018-10-08 01:53 by bup, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg327313 - (view) Author: Dan Snider (bup) * Date: 2018-10-08 01:53
I actually noticed this due to it confusingly breaking IDLE call tips and code completion.

>>> import inspect
>>> from types import MethodType

>>> bound_len = MethodType(len, 'abc')
>>> bound_len()

>>> inspect.signature(bound_len)
<Signature ()>

>>> inspect.signature(len)
<Signature (obj, /)>
msg327605 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-10-12 17:34
What do you consider to be a bug?  The empty signature is correct, as your successful call shows, and the IDLE calltip is, correctly, '()'.

I also do not see how name completion is affected.
Date User Action Args
2022-04-11 14:59:06adminsetgithub: 79105
2022-01-15 19:45:34iritkatrielsetstatus: open -> closed
resolution: not a bug
stage: resolved
2018-10-12 17:34:10terry.reedysetnosy: + terry.reedy
messages: + msg327605
2018-10-08 01:53:51bupcreate