Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,11 @@ Release date: TBA

Closes #6557

* Fix a crash in ``unnecessary-list-index-lookup`` when incorrectly passing no
arguments to ``enumerate()``.

Closes #6603

* Fix a crash when accessing ``__code__`` and assigning it to a variable.

Closes #6539
Expand Down
4 changes: 4 additions & 0 deletions doc/whatsnew/2.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -644,6 +644,10 @@ Other Changes

Closes #6414

* Fix a crash in ``unnecessary-list-index-lookup`` when incorrectly passing no
arguments to ``enumerate()``.

Closes #6603

* Fix false positives for ``no-name-in-module`` and ``import-error`` for ``numpy.distutils``
and ``pydantic``.
Expand Down
1 change: 1 addition & 0 deletions pylint/checkers/refactoring/refactoring_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,7 @@ def _check_unnecessary_list_index_lookup(
not isinstance(node.iter, nodes.Call)
or not isinstance(node.iter.func, nodes.Name)
or not node.iter.func.name == "enumerate"
or not node.iter.args
or not isinstance(node.iter.args[0], nodes.Name)
):
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,7 @@ def process_list_again(data):
pairs = [(0, 0)]
for i, (a, b) in enumerate(pairs):
print(pairs[i][0])

# Regression test for https://github.com/PyCQA/pylint/issues/6603
for i, num in enumerate(): # raises TypeError, but shouldn't crash pylint
pass