Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1ca9392

Browse files
committed
Issue #23095, asyncio: IocpProactor.close() must not cancel pending
_WaitCancelFuture futures
1 parent 0c2e408 commit 1ca9392

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Lib/asyncio/windows_events.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,9 @@ def __init__(self, ov, event, wait_handle, *, loop=None):
163163

164164
self._done_callback = None
165165

166+
def cancel(self):
167+
raise RuntimeError("_WaitCancelFuture must not be cancelled")
168+
166169
def _schedule_callbacks(self):
167170
super(_WaitCancelFuture, self)._schedule_callbacks()
168171
if self._done_callback is not None:
@@ -693,6 +696,9 @@ def close(self):
693696
# FIXME: Tulip issue 196: remove this case, it should not happen
694697
elif fut.done() and not fut.cancelled():
695698
del self._cache[address]
699+
elif isinstance(fut, _WaitCancelFuture):
700+
# _WaitCancelFuture must not be cancelled
701+
pass
696702
else:
697703
try:
698704
fut.cancel()

0 commit comments

Comments
 (0)