Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
There is a race with theKeyboardInterrupt exception in theasyncio.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 timedKeyboardInterrupt will mean that, neither theself._thread_id value 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 inc9118af
| self._thread_id=threading.get_ident() | |
| old_agen_hooks=sys.get_asyncgen_hooks() | |
| sys.set_asyncgen_hooks(firstiter=self._asyncgen_firstiter_hook, | |
| finalizer=self._asyncgen_finalizer_hook) |
This applies to all existing version of Python on all platforms.
Metadata
Metadata
Assignees
Projects
Status
Done