-
-
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
mypy 1.7.0 results in new [misc] type errors with pydantic usage #16454
Comments
Thanks for the repro! Other than This bisects to #15915. It's a little unfortunate, whether it's a bug seems arguable since you can get Any via dataclasses.replace cc @ikonst in case you have an opinion |
I know. My most recent projects are the first time it was even conceivable to use it because enough of the community projects have valid types that it's actually sane to enforce. Having done similar things with TypeScript, I find a lot of value in not allowing explicit use of I only raised this issue because |
It feels wrong that we're raising an "explicit Any" error here when the user didn't directly use Any, it's inside pydantic's code. |
Is it plausible to give more control over the "explicit Any" behavior so we can more easily differentiate user code vs dependency code? Because that would be amazing. |
Type of decorated function contains type "Any"The internal We could: - self.check_untyped_after_decorator(sig, e.func)
+ if e.decorators:
+ self.check_untyped_after_decorator(sig, e.func) This is circumstantial (we're still confusingly checking a "synthetic" function) but would get rid of this error. Explicit "Any" is not allowedThe root cause is that Would it make sense to skip the synthetic FuncDef entirely in |
"Type of decorated function contains type "Any"" is somewhat of a red herring here since I considered maybe when synthesizing A mechanism to skip generated functions is probably the most reasonable fix. |
I was asked to file a bug with more details; it's possible that the behavior is not as much a bug as increased strictness, but given that it impacts a widely used library, I wanted to share (and ask for recommendations on how proceed since manually ignoring this issue across many projects is going to be tedious).
Minimal program:
Minimal setup:
These errors are not reproducible with
mypy
1.6.1
The text was updated successfully, but these errors were encountered: