Hi,

2015-02-12 15:53 GMT+01:00 Ben Darnell <[email protected]>:
> Where is this restriction coming from in the PEP?

It comes from the current implementation of asyncio.
BaseEventLoop.stop() calls call_soon() with a function which raises a
_StopError exception.

I'm in favor of modifying asyncio to change the behaviour of stop():
if stop() is called while the loop is running, the loop only stops at
the end of its current iteration, not immediatly. If stop() if called
before run_forever(), run_forever() does nothing. As Tornado, if I
understood correctly.

Patch:
http://codereview.appspot.com/200390043

With this patch, all asyncio tests still pass. But aiotest tests are
failing, which is expected. aiotest should be fixed.

@Guido: Since you wrote stop(), can you explain the rationale to not
execute all pending callbacks until the end of the current loop
iteration?
https://code.google.com/p/tulip/source/detail?r=a21fbbc9c310

Victor

Reply via email to