New submission from Jimmy Lai: Problem: "RuntimeError: Event loop stopped before Future completed." throws when calling run_until_complete().
We investigate and find out some orphan futures stay in the event loop before we run another run_until_complete(another_async_func()). The orphan future has pending state and is attached with _run_until_complete_cb from previous run_until_complete. It happens because the orphan future thrown Exception and then raise, thus remove_done_callback(_run_until_complete_cb) didn't called. Move it to finally section can fix it. With this patch, we stop seeing the Runtime Error. ---------- components: asyncio messages: 294102 nosy: jimmylai, yselivanov priority: normal pull_requests: 1795 severity: normal status: open title: [asyncio] orphan future close loop and cause "RuntimeError: Event loop stopped before Future completed." versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30423> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com