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

Fatal error for variant of W0632 (unbalanced-tuple-unpacking): Crash list index out of range #5998

Closed
jpy-git opened this issue Mar 27, 2022 · 0 comments · Fixed by #5999
Closed
Labels
Crash 💥 A bug that makes pylint crash Regression
Milestone

Comments

@jpy-git
Copy link
Contributor

jpy-git commented Mar 27, 2022

Bug description

When parsing the following file:

x, y = (1, 2, 3) # This case of W0632 (unbalanced-tuple-unpacking) works fine
x, y, z = (1, 2) # This case causes fatal error!

pylint crashed with a IndexError and with the following stacktrace:

Traceback (most recent call last):
  File "/Users/joe/repos/pylint/pylint/lint/pylinter.py", line 1111, in _check_files
    self._check_file(get_ast, check_astroid_module, file)
  File "/Users/joe/repos/pylint/pylint/lint/pylinter.py", line 1146, in _check_file
    check_astroid_module(ast_node)
  File "/Users/joe/repos/pylint/pylint/lint/pylinter.py", line 1298, in check_astroid_module
    retval = self._check_astroid_module(
  File "/Users/joe/repos/pylint/pylint/lint/pylinter.py", line 1345, in _check_astroid_module
    walker.walk(node)
  File "/Users/joe/repos/pylint/pylint/utils/ast_walker.py", line 76, in walk
    self.walk(child)
  File "/Users/joe/repos/pylint/pylint/utils/ast_walker.py", line 76, in walk
    self.walk(child)
  File "/Users/joe/repos/pylint/pylint/utils/ast_walker.py", line 76, in walk
    self.walk(child)
  File "/Users/joe/repos/pylint/pylint/utils/ast_walker.py", line 73, in walk
    callback(astroid)
  File "/Users/joe/repos/pylint/pylint/checkers/base/name_checker/checker.py", line 390, in visit_assignname
    assign_type.value.elts[node.parent.elts.index(node)]
IndexError: list index out of range

Configuration

No response

Command used

pylint test.py

Pylint output

See traceback above

Expected behavior

Should be detected as another variant of W0632

Pylint version

pylint 2.14.0-dev0
astroid 2.11.0
Python 3.9.10 (main, Jan 15 2022, 11:40:53) 
[Clang 13.0.0 (clang-1300.0.29.3)]

OS / Environment

Mac OS Monterey

Additional dependencies

No response

@jpy-git jpy-git added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Mar 27, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 A bug that makes pylint crash and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Mar 27, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.13.3 milestone Mar 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash Regression
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants