Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspect.signature() doesn't support partialmethod without explicit self parameter #74335

Closed
serhiy-storchaka opened this issue Apr 23, 2017 · 5 comments
Labels
3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@serhiy-storchaka
Copy link
Member

BPO 30149
Nosy @rhettinger, @ncoghlan, @serhiy-storchaka, @1st1, @corona10
PRs
  • bpo-30149: Fix partialmethod without explicit self parameter. #1308
  • [3.6] bpo-30149: Fix partialmethod without explicit self parameter (#1308) #1662
  • [3.5] bpo-30149: Fix partialmethod without explicit self parameter (#1308) #1663
  • 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 2017-06-15.14:44:19.469>
    created_at = <Date 2017-04-23.20:18:25.285>
    labels = ['3.7', 'type-bug', 'library']
    title = "inspect.signature() doesn't support partialmethod without explicit self parameter"
    updated_at = <Date 2017-06-15.14:44:19.468>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2017-06-15.14:44:19.468>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2017-06-15.14:44:19.469>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2017-04-23.20:18:25.285>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 30149
    keywords = []
    message_count = 5.0
    messages = ['292184', '292380', '293877', '296101', '296102']
    nosy_count = 5.0
    nosy_names = ['rhettinger', 'ncoghlan', 'serhiy.storchaka', 'yselivanov', 'corona10']
    pr_nums = ['1308', '1662', '1663']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue30149'
    versions = ['Python 3.5', 'Python 3.6', 'Python 3.7']

    @serhiy-storchaka
    Copy link
    Member Author

    >>> 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'

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Apr 23, 2017
    @corona10
    Copy link
    Member

    I submitted the PR for this issue.

    @1st1
    Copy link
    Member

    1st1 commented May 17, 2017

    New changeset 378d706 by Yury Selivanov (Dong-hee Na) in branch 'master':
    bpo-30149: Fix partialmethod without explicit self parameter (bpo-1308)
    378d706

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset e45ea37 by Serhiy Storchaka (Dong-hee Na) in branch '3.6':
    bpo-30149: Fix partialmethod without explicit self parameter (bpo-1308) (bpo-1662)
    e45ea37

    @serhiy-storchaka
    Copy link
    Member Author

    New changeset fb0825c by Serhiy Storchaka (Dong-hee Na) in branch '3.5':
    bpo-30149: Fix partialmethod without explicit self parameter (bpo-1308) (bpo-1663)
    fb0825c

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants