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

Crash in R1736 #7900

Closed
tushar-deepsource opened this issue Dec 5, 2022 · 4 comments
Closed

Crash in R1736 #7900

tushar-deepsource opened this issue Dec 5, 2022 · 4 comments
Labels
Duplicate 🐫 Duplicate of an already existing issue

Comments

@tushar-deepsource
Copy link
Contributor

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

@tushar-deepsource tushar-deepsource added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Dec 5, 2022
@tushar-deepsource
Copy link
Contributor Author

tushar-deepsource commented Dec 5, 2022

It is fixed on main.

@Pierre-Sassoulas
Copy link
Member

Not released in a patch version because it's too hard to cherry-pick.

@Pierre-Sassoulas Pierre-Sassoulas added Duplicate 🐫 Duplicate of an already existing issue and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Dec 5, 2022
@tushar-deepsource
Copy link
Contributor Author

@Pierre-Sassoulas so will it come out in 2.16.0?

@Pierre-Sassoulas
Copy link
Member

Yes, unless someone manage to backport #7824 on maintenance/2.15.x.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate 🐫 Duplicate of an already existing issue
Projects
None yet
Development

No branches or pull requests

2 participants