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

Saúl Ibarra Corretgé saghul at gmail.com
Mon Feb 11 13:21:44 CET 2013


Hi,

While analyzing some code I came across the following situation:

- User calls run_until_complete for some Task
- The task itself calls loop.stop() at some point
- run_until_complete raises TimeoutError

Here is a very simple example: https://gist.github.com/saghul/4754117

Something seems a bit off here. While one could argue that stopping the 
loop while run_until_complete is ongoing, getting a TimeoutError doesn't 
feel right. I think we should detect that the loop was stopped but the 
future is not done and raise something like NotCompleted or 
FutureNotCompleted.

Thoughts?

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



More information about the Python-ideas mailing list