Description
Bug description
a.py:
def function_with_kwargs(apple, banana="Yellow banana", /, **kwargs):
"""
Calling this function with the `banana` keyword should not emit
`positional-only-arguments-expected` since it is added to `**kwargs`.
>>> function_with_kwargs("Red apple", banana="Green banana")
>>> "Red apple"
>>> "Yellow banana"
>>> {"banana": "Green banana"}
"""
print(apple)
print(banana)
print(kwargs)
Configuration
No response
Command used
pylint a.py
Pylint output
a.py:15:0: E3102: `function_with_kwargs()` got some positional-only arguments passed as keyword arguments: 'banana' (positional-only-arguments-expected)
Expected behavior
No error emitted in this case as the argument passed to the function is part of **kwargs
.
The purpose of this checker is to indicate when an error would occur at runtime, for example:
TypeError: function_with_kwargs() got some positional-only arguments passed as keyword arguments: 'banana'
.
However, in this case, there is no error running this Python code.
Pylint version
pylint 3.0.0b1
astroid 2.16.0dev0
Python 3.10.4
OS / Environment
No response
Additional dependencies
No response