Skip to content

IDLE - call tips show wrapper's argpsec instead of wrapped #73839

Closed

Description

@mr-nfamous
BPO 29653
Nosy @terryjreedy, @mr-nfamous
Superseder
  • bpo-19903: Idle: Use inspect.signature for calltips
  • Files
  • calltips.py
  • 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 = 'https://github.com/terryjreedy'
    closed_at = <Date 2017-02-25.22:50:10.292>
    created_at = <Date 2017-02-25.20:34:32.419>
    labels = ['expert-IDLE', 'type-feature']
    title = "IDLE - call tips show wrapper's argpsec instead of wrapped"
    updated_at = <Date 2017-02-25.22:50:10.289>
    user = 'https://github.com/mr-nfamous'

    bugs.python.org fields:

    activity = <Date 2017-02-25.22:50:10.289>
    actor = 'terry.reedy'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2017-02-25.22:50:10.292>
    closer = 'terry.reedy'
    components = ['IDLE']
    creation = <Date 2017-02-25.20:34:32.419>
    creator = 'bup'
    dependencies = []
    files = ['46669']
    hgrepos = []
    issue_num = 29653
    keywords = []
    message_count = 2.0
    messages = ['288580', '288584']
    nosy_count = 2.0
    nosy_names = ['terry.reedy', 'bup']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '19903'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue29653'
    versions = ['Python 3.6']

    Activity

    1. mr-nfamous commented on Feb 25, 2017

      mr-nfamousmannequin
      MannequinAuthor

      Many wrappers use the famous (*args, **kwargs) argspec, which is less than helpful for a function that uses some positional arguments and maybe a few keyword only arguments, ie (x, y, z=10). Other IDEs have the capability of showing the wrapped functions argspec in a calltip, so why shouldn't IDLE?

    2. terryjreedy commented on Feb 25, 2017

      @terryjreedy
      Member

      We usually prefer diffs rather than revised files, but I know not everyone can provide them. Did you change anything other than add the following?
      elif hasattr(ob, '__wrapped__') and callable(ob.__wrapped__):
      fob = ob.__wrapped__

      I am all for accurate calltips. However, your patch will not work for the stdlib wrapper functools.partial. It does not add a __wrapped__ attribute. Instead it had args, func, and kwargs attributes.

      I plan on switching calltips from using inspect.getfullargspec to inspect.signature (bpo-19903). The latter defaults to follow_wrapped=True, in which case, it should follow callable.__wrapped__. https://docs.python.org/3/library/inspect.html#inspect.signature. It also is documented to work with partials and in my test, it indeed followed .func to get the original signature and remove the parameters set in the partial call.

      So this request is a duplicate in that it will be fixed by the existing issue.

    3. 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

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions