]> 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:44 +0000 (14:39 -0700)
committerGitHub <noreply@github.com>
Mon, 3 Oct 2022 21:39:44 +0000 (14:39 -0700)
commita7e281150e9d4ad04f4b7276eb25870a0d37fbda
tree2014f50a4cfdb79d881c0a6657d70a6a38fb0beb
parent769b9dccd2f796ffd0a75c1d088f2023c3ca28f7
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