-
Notifications
You must be signed in to change notification settings - Fork 117
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 when AssignAttr is inferred as a class #349
Comments
Just to add.
We need to rule out scenario 1 before trying to fix a potential scenario 2. We'll probably do so when we investigate the issue raised against |
The way that pylint-django uses it (as far as I can remember) is mostly for
to know if an instance of SomeModel also gets all of the metaclass additions that the base model class does. Therefore
then So I think that perhaps the correct fix in However this is just speculation, I'll wait until you finish your investigation before probing further. |
The
But one potential fix at this level would filter out
This prevents the crash. |
I need to see some code to precisely see what you're suggesting here, but can't we use this in combination with @carlio suggestion of taking the actual right-hand value that is being assigned in the |
Yup, the filter was more of a proof of concept. We could do something like,
Though |
I guess so? We could also return |
Added a draft PR to process nodes so they always have a |
I lost track of this bug for a bit but it would be good to close. What do we think of the PR? It follows the suggestion from @carlio above to get the value of the |
It makes sense to me to do it this way, and as the tests are passing, I'm happy to merge and release :-) Thanks @areveny ! |
This is a crash separately reproduced by @DanielNoord and I in this PR: pylint-dev/astroid#1373
When overwriting a module name that later gets inferred, a crash can result because we get an
AssignAttr
node where we normally only expectClassDef
.There is an
astroid
issue tracking a very similar issue: pylint-dev/astroid#1374. The fix inpylint-django
should be similar to the one forastroid
, so we can wait until theastroid
PR is created and merged and create an equivalent PR here.The text was updated successfully, but these errors were encountered: