summaryrefslogtreecommitdiff
path: root/docs/conf.py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-10-21 12:13:44 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-12-15 20:20:36 +0200
commit63644016669c173190c71d39fb33ad9502fe2b0f (patch)
treed92986fbcfdd6944792e852fc6d5023cb4c724d6 /docs/conf.py
parentf4ed2dfa942339dc1f174e8a83ff0d41073f1972 (diff)
py/objgenerator: Allow to pend an exception for next execution.
This implements .pend_throw(exc) method, which sets up an exception to be triggered on the next call to generator's .__next__() or .send() method. This is unlike .throw(), which immediately starts to execute the generator to process the exception. This effectively adds Future-like capabilities to generator protocol (exception will be raised in the future). The need for such a method arised to implement uasyncio wait_for() function efficiently (its behavior is clearly "Future" like, and normally would require to introduce an expensive Future wrapper around all native couroutines, like upstream asyncio does). py/objgenerator: pend_throw: Return previous pended value. This effectively allows to store an additional value (not necessary an exception) in a coroutine while it's not being executed. uasyncio has exactly this usecase: to mark a coro waiting in I/O queue (and thus not executed in the normal scheduling queue), for the purpose of implementing wait_for() function (cancellation of such waiting coro by a timeout).
Diffstat (limited to 'docs/conf.py')
0 files changed, 0 insertions, 0 deletions