-
-
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
0.990 reports error for function with body that is just ellipsis #14048
Comments
This was an intentional change in 0.990 and the special casing for |
cc @ilevkivskyi |
Yep, I will update the docs. Now you need |
Thank's for clarifying.
I'm unsure if I want the old behavior🤔 Actually I was ever in doubt if the way I used such class FooStub:
# Serves as means to check calls to use_generated_foo() with mypy
def bar() -> int:
...
class GeneratedFoo(RuntimeAttrGen, FooStub):
# Attributes made available at runtime, according to external spec.
# I control the spec and therefore know what methods and attributes will be available,
# but can't hardcode implementations here.
pass
def use_generated_foo(x: FooStub)
x.bar() Would you recommend another approach for type checking such runtime-determined types? E.g., I'd rather avoid deriving from |
IIUC the situation, my personal preference would be to replace |
To clarify, mypy will also not complain about this. |
Fixes #14048 Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Fixes #14048 Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
mypy 0.990 (python 3.8) reports an error for the following source code
mypy 0.981 would let the same code pass. Was that an intended change in between, or a regression?
From mypy CLI documentation
I'd expect Success for the given example, because the 2nd exception ("body that is just ellipsis") applies.
The text was updated successfully, but these errors were encountered: