It's too strict IMHO. Where is this restriction coming from in the PEP? In "the intention is to stop short of polling for I/O, and not to run any callbacks scheduled in the future" I read that as a SHOULD and not a MUST; it goes on to say that implementations have freedom in terms of how much of the ready queue they run before stopping.
FWIW, in Tornado when you call stop() before start(), the start() becomes a no-op and so we wouldn't run either callback the first time. If you explicitly scheduled stop() on the IOLoop (i.e. call_soon(hello); call_soon(stop); call_soon(world)), we would run both callbacks before stopping. -Ben On Thu, Feb 12, 2015 at 7:17 AM, Victor Stinner <[email protected]> wrote: > Hi, > > I wrote the aiotest test suite to check if an implementation of the > PEP 3156 is compliant with PEP. I wrote a test to ensure that > functions scheduled with call_soon() after a call to stop() are not > executed before the next call to run_forever(): > > > https://bitbucket.org/haypo/aiotest/src/22ecbabe626874bb30a801a49bc87568fadf3fcc/aiotest/test_callback.py?at=default#cl-34 > > Is my test too strict, or do implementations respect this restriction? > > Victor >
