Guido van Rossum added the comment: How about we extend loop.stop() so that you can pass it an exception to raise once the loop is stopped? This exception would then be thrown out of run_forever(). There may be some delay (callbacks already scheduled will run first) but it is how things were meant to be.
FWIW this isn't really enough to ensure cleanup happens before destructors run -- when the loop exits, tasks may still be active unless you keep track of all of them and explicitly cancel them (and run the loop until they have processed the cancellation). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25489> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com