-
-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Ast conversion for a dataclass raises DuplicateBasesError which crashes Pylint #2628
Comments
Feels to me like we should fix:
Not by telling it to ignore duplicates, but by making it understand that some things aren't duplicates. |
I agree that improvements in recognizing non-duplicates in
Therefore, only changing/improving Another example to consider is the comparison between the following code snippets: class Duplicates(str, str):
pass and import dataclasses
@dataclasses.dataclass
class Duplicates(str, str):
pass For the first one Pylint finishes linting and reports |
Hmm yeah I understand the problem a little better now. @jacobtylerwalls do you have an opinion here? I have tried all day but couldn't come up with a better solution than this boolean flag, but I don't really like it. |
My thought is that brain_dataclasses.py should be catching |
But here we actually want to compute the |
That seems fine to me. This is an edge case, no? And there are other errors that subclass MroError we should catch also, I think. |
Here is an example that causes Pylint to crash because Astroid raises an unexpected error:
This is a valid Python code but running Pylint crashes with the following stack trace:
Command used
Pylint output
pylint crashed with a ``AstroidBuildingError`` and with the following stacktrace:
Expected behavior
No crash.
Pylint version
OS / Environment
linux (Linux)
Additional dependencies
Note that this only happens for a dataclass because
brain_dataclasses.py
callsnode.mro()
which can raise the error and the error is never caught.The text was updated successfully, but these errors were encountered: