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

False positive for repeated-keywords when dict item is popped off #7614

Open
amrishparmar opened this issue Oct 12, 2022 · 1 comment
Open
Labels
Control flow Requires control flow understanding False Positive 🦟 A message is emitted but nothing is wrong with the code

Comments

@amrishparmar
Copy link

amrishparmar commented Oct 12, 2022

Bug description

We found that if a dictionary is unpacked as arguments to a function, pylint still flags the repeated-keywords even if a pop happens on the dictionary in between (meaning that no kwargs are actually repeated)

Fairly minimal example:

def foo(a=None, b=None, c=None):
    pass

d = {"a": 1, "b": 2, "c": 3}

x = d.pop("c")  

foo(c=x, **d)

Configuration

No response

Command used

pylint --disable=all --enable=repeated-keyword test.py

Pylint output

************* Module test
test.py:8:0: E1132: Got multiple values for keyword argument 'c' in function call (repeated-keyword)

------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)

Expected behavior

No error is flagged for the line

Pylint version

pylint 2.15.4
astroid 2.12.11
Python 3.10.6 (main, Oct  7 2022, 20:19:58) [GCC 11.2.0]

OS / Environment

No response

Additional dependencies

No response

@amrishparmar amrishparmar added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Oct 12, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Control flow Requires control flow understanding False Positive 🦟 A message is emitted but nothing is wrong with the code and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Oct 12, 2022
@Pierre-Sassoulas
Copy link
Member

Thank you for opening the issue. It's probably blocked by #4795

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Control flow Requires control flow understanding False Positive 🦟 A message is emitted but nothing is wrong with the code
Projects
None yet
Development

No branches or pull requests

2 participants