-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed as not planned
Labels
Crash 💥A bug that makes pylint crashA bug that makes pylint crashDuplicate 🐫Duplicate of an already existing issueDuplicate of an already existing issue
Milestone
Description
Bug description
Minimal example (in our code which initially triggered the bug, the addition consisted of one variable and one literal):
def this_crashes_pylint(arr):
for i, v in enumerate(arr, 1+1):
pass
def this_is_fine(arr):
for i, v in enumerate(arr, 1):
pass
Configuration
# Default pylint config i.e. no config.
Command used
pylint crash.py
Pylint output
************* Module crash
crash.py:8:0: C0305: Trailing newlines (trailing-newlines)
crash.py:1:0: C0114: Missing module docstring (missing-module-docstring)
crash.py:1:0: C0116: Missing function or method docstring (missing-function-docstring)
Exception on node <For l.2 at 0x7fccd1fa95d0> in file '/tmp/pylintcrash/crash.py'
Traceback (most recent call last):
File "/tmp/pylintcrash/venv/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 90, in walk
callback(astroid)
File "/tmp/pylintcrash/venv/lib/python3.10/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 682, in visit_for
self._check_unnecessary_list_index_lookup(node)
File "/tmp/pylintcrash/venv/lib/python3.10/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 2118, in _check_unnecessary_list_index_lookup
has_start_arg, confidence = self._enumerate_with_start(node)
File "/tmp/pylintcrash/venv/lib/python3.10/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 2236, in _enumerate_with_start
start_val, confidence = self._get_start_value(start_arg)
File "/tmp/pylintcrash/venv/lib/python3.10/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 2260, in _get_start_value
start_val = node.value
AttributeError: 'BinOp' object has no attribute 'value'
crash.py:1:0: F0002: crash.py: Fatal error while checking 'crash.py'. Please open an issue in our bug tracker so we address this. There is a pre-filled template that you can use in '/home/corbatto/.cache/pylint/pylint-crash-2022-12-20-08-35-59.txt'. (astroid-error)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)
Expected behavior
Should not crash.
Pylint version
pylint 2.15.9
astroid 2.12.13
Python 3.10.8 (main, Nov 1 2022, 14:18:21) [GCC 12.2.0]
Likely introduced in this release, since we've been checking the exact same lines of code for months if not years without a crash.
OS / Environment
ArchLinux with zen kernel 6.0.12. Terminal: alacritty + tmux + zsh. It also happened on an ubuntu based bamboo worker, don't know the exact version.
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
Crash 💥A bug that makes pylint crashA bug that makes pylint crashDuplicate 🐫Duplicate of an already existing issueDuplicate of an already existing issue