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

Even after #7429 merged, a crash AttributeError: 'ClassDef' object has no attribute 'value' #7467

Closed
akaihola opened this issue Sep 15, 2022 · 0 comments · Fixed by #7473
Closed
Assignees
Labels
Crash 💥 A bug that makes pylint crash Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@akaihola
Copy link

akaihola commented Sep 15, 2022

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.py

Pylint 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

@akaihola akaihola added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Sep 15, 2022
@Pierre-Sassoulas Pierre-Sassoulas added Crash 💥 A bug that makes pylint crash and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Sep 15, 2022
@Pierre-Sassoulas Pierre-Sassoulas added this to the 2.15.3 milestone Sep 15, 2022
@jacobtylerwalls jacobtylerwalls added the Needs PR This issue is accepted, sufficiently specified and now needs an implementation label Sep 15, 2022
@Pierre-Sassoulas Pierre-Sassoulas added the Needs astroid update Needs an astroid update (probably a release too) before being mergable label Sep 16, 2022
@Pierre-Sassoulas Pierre-Sassoulas self-assigned this Sep 16, 2022
@Pierre-Sassoulas Pierre-Sassoulas removed the Needs astroid update Needs an astroid update (probably a release too) before being mergable label Sep 16, 2022
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Sep 16, 2022
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Sep 16, 2022
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Sep 16, 2022
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Sep 16, 2022
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Sep 16, 2022
Pierre-Sassoulas added a commit to Pierre-Sassoulas/pylint that referenced this issue Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Crash 💥 A bug that makes pylint crash Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants