Race with KeyboardInterrupt in asyncio loop run_forever() method #94732
Copy link
Copy link
Closed
Labels
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jul 11, 2022 - added a commit that references this issue
on Sep 14, 2022 - added a commit that references this issue
on Oct 3, 2022 - added 4 commits that reference this issue
on Oct 3, 2022 Fixed!
@hetmankp: Thanks for being flexible regarding the CLA bot. I hope the problem is now fixed for you going forward?
- added a commit that references this issue
on Oct 3, 2022 Fixed!
@hetmankp: Thanks for being flexible regarding the CLA bot. I hope the problem is now fixed for you going forward?
Thanks @gvanrossum , yes as far as CPython is concerned I should be covered (not sure why the simpler email format wasn't working but I guess it will remain a mystery for now).
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsDone
There is a race with the
KeyboardInterruptexception in the asyncio.base_events.BaseEventLoop.run_forever() method. While an attempt is made to restore the environment to its previous state beforerun_forever()completes with atry...finally, a couple items find themselves outside thetry...finally. Specifically, a badly timedKeyboardInterruptwill mean that, neither theself._thread_idvalue or the hooks set bysys.set_asyncgen_hooks()will be correctly restored. Both of these should be moved inside thetry...finally.cpython/Lib/asyncio/base_events.py
Lines 596 to 600 in c9118af
This applies to all existing version of Python on all platforms.