-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Type check error with asdict #987
Comments
Given that your asdict is protected by a The problem is that we introduced an AttrsInstance Protocol. It looks like we forgot to add a newsfragment. |
@hynek I notice that |
@Tinche did we just forget it? |
Yeah I think so ;/ |
Probably worth nothing that def has(cls: type) -> TypeGuard[type[AttrsInstance]]: ... Elsewhere: [...]
if attr.has(type(self)):
# `self` is now an `AttrsInstance`
return attr.asdict(self) # Passes! But I suspect that |
fixed by #997 |
fixes AttrsInstance import failing, fixed by python-attrs/attrs#987
fixes AttrsInstance import failing, fixed by python-attrs/attrs#987
fixes AttrsInstance import failing, fixed by python-attrs/attrs#987
Starting with version attrs 22.1.0, I started running into a type checking issue when running mypy. In particular, this occurs when calling asdict in parent class where that parent class does not use attrs but the child might.
This is a bit of an odd scenario so I'm not sure if the bug belongs here in attrs, mypy, or should just be an error. However, it did not produce any type checking errors using attrs 21.4.0.
The text was updated successfully, but these errors were encountered: