Skip to content

Crash: AstroidError in refactoring_checker.py #8207

Closed
@belm0

Description

@belm0

Bug description

proprietary code, I haven't tried to narrow it down

pylint crashed with AstroidError and with the following stacktrace:

Traceback (most recent call last):
  File "/.../python3.8/site-packages/pylint/lint/pylinter.py", line 798, in _lint_file
    check_astroid_module(module)
  File "/.../python3.8/site-packages/pylint/lint/pylinter.py", line 1067, in check_astroid_module
    retval = self._check_astroid_module(
  File "/.../python3.8/site-packages/pylint/lint/pylinter.py", line 1117, in _check_astroid_module
    walker.walk(node)
  File "/.../python3.8/site-packages/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  File "/.../python3.8/site-packages/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  File "/.../python3.8/site-packages/pylint/utils/ast_walker.py", line 94, in walk
    self.walk(child)
  [Previous line repeated 2 more times]
  File "/.../python3.8/site-packages/pylint/utils/ast_walker.py", line 91, in walk
    callback(astroid)
  File "/.../python3.8/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 1731, in visit_comprehension
    self._check_unnecessary_list_index_lookup(node)
  File "/.../python3.8/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 2208, in _check_unnecessary_list_index_lookup
    has_start_arg, confidence = self._enumerate_with_start(node)
  File "/.../python3.8/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 2326, in _enumerate_with_start
    start_val, confidence = self._get_start_value(start_arg)
  File "/.../python3.8/site-packages/pylint/checkers/refactoring/refactoring_checker.py", line 2346, in _get_start_value
    return node.operand.value, HIGH
AttributeError: 'Attribute' object has no attribute 'value'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/.../python3.8/site-packages/pylint/lint/pylinter.py", line 763, in _lint_files
    self._lint_file(fileitem, module, check_astroid_module)
  File "/.../python3.8/site-packages/pylint/lint/pylinter.py", line 800, in _lint_file
    raise astroid.AstroidError from e
astroid.exceptions.AstroidError

Configuration

No response

Command used

pylint

Pylint output

n/a

Expected behavior

n/a

Pylint version

pylint 2.16.1
astroid 2.14.1
Python 3.8.12 (default, Sep 23 2021, 08:42:37)
[Clang 12.0.0 (clang-1200.0.32.29)]

OS / Environment

No response

Additional dependencies

No response

Metadata

Metadata

Labels

Crash 💥A bug that makes pylint crashNeeds PRThis issue is accepted, sufficiently specified and now needs an implementation

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions