-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
Crash 💥A bug that makes pylint crashA bug that makes pylint crashNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation
Milestone
Description
Bug description
When parsing the following file, Pylint crashes:
class AnotherClass:
...
class Pylint7429:
def foo(self):
self.__class__, myvar = AnotherClass, "myvalue"Pylint versions prior to 2.9 run fine on the same file.
Configuration
No response
Command used
pylint /tmp/pylint7429.pyPylint output
************* Module pylint7429
[...]
Exception on node <AssignAttr.__class__ l.7 at 0x7fb5f19060d0> in file '/tmp/pylint7429.py'
Traceback (most recent call last):
File "pylint/utils/ast_walker.py", line 90, in walk
callback(astroid)
File "pylint/checkers/classes/class_checker.py", line 1556, in visit_assignattr
self._check_invalid_class_object(node)
File "pylint/checkers/classes/class_checker.py", line 1561, in _check_invalid_class_object
inferred = safe_infer(node.parent.value)
File "astroid/bases.py", line 134, in __getattr__
return getattr(self._proxied, name)
AttributeError: 'ClassDef' object has no attribute 'value'
/tmp/pylint7429.py:1:0: F0002: /tmp/pylint7429.py: Fatal error while checking '/tmp/pylint7429.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/akaihola/.cache/pylint/pylint-crash-2022-09-15-14-06-01.txt'. (astroid-error)
------------------------------------------------------------------
Your code has been rated at 0.00/10 (previous run: 0.00/10, +0.00)Expected behavior
Expect pylint to not crash
Pylint version
pylint 2.15.2
astroid 2.12.9
Python 3.8.13 (default, Mar 16 2022, 13:02:57)
[GCC 11.3.0]OS / Environment
NixOS 22.05
Additional dependencies
No response
Metadata
Metadata
Assignees
Labels
Crash 💥A bug that makes pylint crashA bug that makes pylint crashNeeds PRThis issue is accepted, sufficiently specified and now needs an implementationThis issue is accepted, sufficiently specified and now needs an implementation