-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Argument 1 to "fields" has incompatible type "type[AttrsInstance]"; expected an attrs class #16254
Comments
I'm also seeing this in 1.6, but not 1.5.1. |
I started seeing this when my mypy version jumped from 1.5.1 -> 1.6.1. No difference in my source code or attrs version. Code to reproduce: import attr
@attr.s(frozen=True)
class MyClass(object):
@classmethod
def fields(cls):
return attr.fields(cls) we can then see: $ .venv/bin/mypy test.py
exp.py:7: error: Argument 1 to "fields" has incompatible type "type[MyClass]"; expected an attrs class [misc]
return attr.fields(cls)
^~~~~~~~~~~~~~~~
Found 1 error in 1 file (checked 1 source file) |
I am too. However, I tested with the latest from |
This was fixed in #15983. |
Do you know if we will get a 1.6.2 cut with this fix? |
Probably not; mypy 1.7 is expected soon, I believe. But @hauntsaninja has been managing patch releases for mypy 1.6, so it'll be up to him to decide |
Bug Report
mypy is reporting that a
type[attrs.AttrsInstance]
is not a valid argument toattrs.fields
To Reproduce
Expected Behavior
% mypy x.py
Success: no issues found in 1 source file
Actual Behavior
% mypy x.py
x.py:15: error: Argument 1 to "fields" has incompatible type "type[AttrsInstance]"; expected an attrs class [misc]
Found 1 error in 1 file (checked 1 source file)
Your Environment
mypy.ini
(and other config files): defaultThe text was updated successfully, but these errors were encountered: