Skip to content

Crash in R1736 #7900

Closed
Closed
@tushar-deepsource

Description

@tushar-deepsource

Bug description

for i, el in enumerate(l, start=1 + 1):
    ...

Configuration

No response

Command used

pylint asd.py --disable=all --enable=R1736

Pylint output

pylint asd.py --disable=all --enable=R1736
Exception on node <For l.2 at 0x1027e73a0> in file '/Users/tusharsadhwani/code/marvin-python/asd.py'
Traceback (most recent call last):
  File "/Users/tusharsadhwani/code/marvin-python/venv3/lib/python3.10/site-packages/pylint/utils/ast_walker.py", line 90, in walk
    callback(astroid)
  File "/Users/tusharsadhwani/code/marvin-python/venv3/lib/python3.10/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 682, in visit_for
    self._check_unnecessary_list_index_lookup(node)
  File "/Users/tusharsadhwani/code/marvin-python/venv3/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 "/Users/tusharsadhwani/code/marvin-python/venv3/lib/python3.10/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 2243, in _enumerate_with_start
    start_val, confidence = self._get_start_value(keyword.value)
  File "/Users/tusharsadhwani/code/marvin-python/venv3/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'

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

Expected behavior

No crash

Pylint version

pylint 2.15.7
astroid 2.12.13
Python 3.10.6 (main, Aug 30 2022, 04:58:14) [Clang 13.1.6 (clang-1316.0.21.2.5)]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Duplicate 🐫Duplicate of an already existing issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions