]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-94732: Fix KeyboardInterrupt race in asyncio run_forever() (GH-97765)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 3 Oct 2022 21:39:24 +0000 (14:39 -0700)
committerGitHub <noreply@github.com>
Mon, 3 Oct 2022 21:39:24 +0000 (14:39 -0700)
commit4420da0aefc31b066f3b0d80ceed8ce0edbcc7c2
treeb1bf3865b5f51f5c910c0514b95cc3f20a2baf30
parentfe99b64bef012cdf90b84a7cfe62a1d1a550ce55
gh-94732: Fix KeyboardInterrupt race in asyncio run_forever() (GH-97765)

Ensure that the event loop's `_thread_id` attribute and the asyncgen hooks set by `sys.set_asyncgen_hooks()` are always restored no matter where a KeyboardInterrupt exception is raised.
(cherry picked from commit 3a49dbb98ccc1b90554ed181386316efa38adfba)

Co-authored-by: hetmankp <728670+hetmankp@users.noreply.github.com>
Lib/asyncio/base_events.py