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
incorrect type annotation on inlineCallbacks #10231
Comments
a float is an object:
|
I think is closer - but this only allows the same type of Deferred to be yielded |
the following can work though:
and that's fixed here: https://github.com/twisted/twisted/pull/1624/files#r668723516 |
Replying to Thomas Grainger:
hrm. Today I learnt! |
Please try to keep ticket state up to date |
Thomas: I'm going to mark this issue resolved, as from my point of view 21.7.0rc2 is very much good enough for now. Hope that's ok. You're right that it's not perfect but it's not obvious to me we can really do better without significant extra complexity. |
defer.inlineCallbacks
currently has the following signature:Three things here:
f
, why do theYieldType
andSendType
useobject
rather thanAny
? There is nothing to say that the Deferreds yielded will resolve to anobject
rather than, say, a float.None
the result of theGenerator
rather thanAny
(or a type variable)? Functions wrapped byinlineCallbacks
have been allowed to return things ever since Python 3.3 added support forreturn
in generators.Deferred[object]
? Again, there is nothing to say that it will be an object rather than a float.I think it should be:
Searchable metadata
The text was updated successfully, but these errors were encountered: