pylint
pylint copied to clipboard
New checker - `unbalanced-dictionary-unpacking`
Bug description
Also mentioned in discussion in https://github.com/PyCQA/pylint/issues/5113.
The following situation does not issue a message from Pylint: a.py:
for a, b, c, d, e, f, g in {1: 2}.items():
pass
On the other hand, Python gives:
Traceback (most recent call last):
File "a.py", line 1, in <module>
for a, b, c, d, e, f, g in {1: 2}.items():
ValueError: not enough values to unpack (expected 7, got 2)
Configuration
No response
Command used
pylint a.py
Pylint output
No output
Expected behavior
Emit a message indicating the unpacking error.
Pylint version
pylint 2.13.0-dev0
astroid 2.9.3
Python 3.10.0b2 (v3.10.0b2:317314165a, May 31 2021, 10:02:22) [Clang 12.0.5 (clang-1205.0.22.9)]
OS / Environment
No response
Additional dependencies
No response
Is this a false negative or a new message? And if the latter, can we come up with a good name for a good message?
Good point @DanielNoord - I thought one of the existing unpacking checkers could cover it but perhaps not.
Perhaps unbalanced-dictionary-unpacking
?
Yeah that works for me!