-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Confusing error about __attrs_attrs__ when using multiple inheritance #12065
Comments
Interesting, I can take a look at this. |
In runtime,
So I'm guessing it just follows the MRO and gets the class attribute from A. Here's the equivalent situation without attrs:
This is a Mypy error ( So if we want to keep this behavior and still raise an error, the note approach is the way to go? |
Yeah, the note approach seems fine. If you don't use |
This feels similar to #12008. (Does attrs autocreate |
It does. |
This code now generates an error about class AB:
The code is arguably questionable, and the error goes away if we decorate AB with
@attr.s
, but that's not clear from the error message. It would be better to add a note, such as something like this:This started happening after #11794, and it might be considered a minor regression because of the confusing message.
(Behind the scenes, a
__attrs_attrs__
attribute gets generated with a class-specific named tuple as the type. These named tuples aren't compatible with each other.)cc @Tinche
The text was updated successfully, but these errors were encountered: