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/pablogsal'closed_at=<Date2019-10-15.12:46:36.956>created_at=<Date2019-10-15.02:26:32.669>labels= ['3.8', 'type-bug', 'library', '3.9']
title='inspect.signature.bind does not correctly handle keyword argument with same name as positional-only parameter'updated_at=<Date2019-10-15.12:46:36.955>user='https://github.com/orez'
>>> import inspect
>>> deffoo(bar, /, **kwargs):
... print(bar, kwargs)
...
>>> foo(1, bar=2)
1 {'bar': 2}
>>> inspect.signature(foo).bind(1, bar=2)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/inspect.py", line 3025, in bind
return self._bind(args, kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/inspect.py", line 2964, in _bind
raise TypeError(
TypeError: multiple values for argument 'bar'
Python 3.8 introduced positional-only parameters, which allow parameter names to remain available for use in **kwargs. It looks like inspect.signature.bind does not recognize this, and thinks the parameter is being passed twice, which causes the above TypeError.
New changeset f3ef06a by Pablo Galindo in branch 'master': bpo-38478: Correctly handle keyword argument with same name as positional-only parameter (GH-16800) f3ef06a
New changeset f705f8e by Miss Islington (bot) in branch '3.8': bpo-38478: Correctly handle keyword argument with same name as positional-only parameter (GH-16800) f705f8e
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: