Skip to content

inspect.signature isn't aware that types.MethodType can wrap any callable #79105

Closed

Description

@mr-nfamous
mannequin
BPO 34924
Nosy @terryjreedy, @mr-nfamous

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2022-01-15.19:45:34.357>
created_at = <Date 2018-10-08.01:53:51.314>
labels = ['invalid', '3.7', 'library']
title = "inspect.signature isn't aware that types.MethodType can wrap any callable"
updated_at = <Date 2022-01-15.19:45:34.357>
user = 'https://github.com/mr-nfamous'

bugs.python.org fields:

activity = <Date 2022-01-15.19:45:34.357>
actor = 'iritkatriel'
assignee = 'none'
closed = True
closed_date = <Date 2022-01-15.19:45:34.357>
closer = 'iritkatriel'
components = ['Library (Lib)']
creation = <Date 2018-10-08.01:53:51.314>
creator = 'bup'
dependencies = []
files = []
hgrepos = []
issue_num = 34924
keywords = []
message_count = 2.0
messages = ['327313', '327605']
nosy_count = 2.0
nosy_names = ['terry.reedy', 'bup']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue34924'
versions = ['Python 3.7']

Activity

  1. mr-nfamous commented on Oct 8, 2018

    mr-nfamousmannequin
    MannequinAuthor

    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()
    3
    
    >>> inspect.signature(bound_len)
    <Signature ()>
    
    >>> inspect.signature(len)
    <Signature (obj, /)>
  2. added
    3.7 (EOL)
    stdlib
    on Oct 8, 2018
  3. terryjreedy commented on Oct 12, 2018

    @terryjreedy
    Member

    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.

  4. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.7 (EOL)stdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions