Uh oh!
There was an error while loading. Please reload this page.
contextmanager decorators require Generators - #2773
Conversation
asottile
commented
Jan 30, 2019
the sample from the issue now fails with: I wasn't sure what to put for the other generic parameters for Also wasn't sure how else to test this so hopefully CI points me in the right direction if I've messed it up 😆 |
asottile
commented
Jan 30, 2019
hmmm, CI is failing -- looks like |
ilevkivskyi
commented
Jan 30, 2019
Will this allow: @contextmanagerdeffunc() ->Iterator[int]:
yield1# explicitIf not, then there is no way this can be merged. There are thousands existing annotations like this, and we can't make them all fail because of a false negative in rare corner case. |
asottile
commented
Jan 30, 2019
it will not, my original issue is because of a particularly nasty bug enabled by a developer's misunderstanding of how |
ilevkivskyi
commented
Jan 30, 2019
Actually there is basic support for warnings in mypy. But currently warnings still give return code 1. There is some (slowly moving) ongoing work on how to treat errors/warnings more systematically. |
JelleZijlstra
commented
Feb 1, 2019
I agree with @ilevkivskyi that we can't afford to break all existing annotations that use Another way forward could be to add special-casing in mypy that detects when a generator function has |
msullivan
commented
Feb 1, 2019
This seems like a good idea to me |
srittau
commented
Oct 10, 2019
I have marked this as deferred for now. While I think that in general typeshed should have exact types, but backwards compatibility is an issue. Until that is solved/worked around we can't merge this. |
Resolves#2772