[Python-ideas] PEP 3156 / Tulip: stopping the loop while in run_until_complete

Saúl Ibarra Corretgé saghul at gmail.com
Mon Feb 11 19:18:18 CET 2013


Guido van Rossum wrote:
> Yeah, I think the base implementation of run_until_complete is wrong.
> I think I didn't have stop() when I coded that.
>
> Could you change it to something that just registers a lambda calling
> stop() on the Future, and see if that makes your test case behave
> better? (If so, please add a unit test and submit for code review.)
>

Hum, I guess I'm missing something, but futures don't have a stop() 
method. The code already calls loop.stop() when the future is done.

What I had in mind was to add a _called to Handler and expose it with a 
readonly property, so then we could check if handler.called and raise 
TimeoutError or not. As for raising another exception, maybe it's not 
such a good idea, since caller can always check future.done() later anyway.

-- 
Saúl Ibarra Corretgé
http://saghul.net/blog | http://about.me/saghul



More information about the Python-ideas mailing list