[Python-ideas] PEP 3156 / Tulip: stopping the loop while in run_until_complete
Guido van Rossum
guido at python.org
Mon Feb 11 17:06:16 CET 2013
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.)
On Mon, Feb 11, 2013 at 4:21 AM, Saúl Ibarra Corretgé <saghul at gmail.com> wrote:
> 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
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
--
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas
mailing list