-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
'ListComp' object has no attribute 'name' when variable is named "type" #5461
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
Comments
@xavfernandez Thanks for opening the issue. Personally, I wouldn't recommend to use |
@cdce8p Yes, I usually also avoid builtin names (and I actually fixed the crash in my build by renaming the variable). And now that I think about it, the bug doesn't happen in Python 3.8:
vs
|
That's to be expected. The bug is related to the handling of builtin types in Python 3.9 and higher. It will be fixed with pylint-dev/astroid#1285. |
@cdce8p Do we still want to add a test for this in |
Made a PR with little regression test |
Bug description
Pylint/Astroid crashes on list comprehension using a variable named
type
.crashes but
doesn't.
Configuration
No response
Command used
Pylint output
Expected behavior
No crash
Pylint version
OS / Environment
No response
Additional dependencies
astroid==2.9.0
isort==5.10.1
lazy-object-proxy==1.6.0
mccabe==0.6.1
platformdirs==2.4.0
pylint==2.12.1
toml==0.10.2
typing_extensions==4.0.1
wrapt==1.13.3
The text was updated successfully, but these errors were encountered: