Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
When shutting down an executor, don't wake a closed loop
  • Loading branch information
gvanrossum committed Sep 15, 2022
commit 471792d2f63734207f105bf6bc9f4d594f662b5e
6 changes: 4 additions & 2 deletions Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,11 @@ async def shutdown_default_executor(self):
def _do_shutdown(self, future):
try:
self._default_executor.shutdown(wait=True)
self.call_soon_threadsafe(future.set_result, None)
if not self.is_closed():
self.call_soon_threadsafe(future.set_result, None)
except Exception as ex:
self.call_soon_threadsafe(future.set_exception, ex)
if not self.is_closed():
self.call_soon_threadsafe(future.set_exception, ex)

def _check_running(self):
if self.is_running():
Expand Down