]> granicus.if.org Git - python/commitdiff
Issue #23095, asyncio: IocpProactor.close() must not cancel pending
authorVictor Stinner <victor.stinner@gmail.com>
Wed, 21 Jan 2015 23:17:54 +0000 (00:17 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Wed, 21 Jan 2015 23:17:54 +0000 (00:17 +0100)
_WaitCancelFuture futures

Lib/asyncio/windows_events.py

index 5105426f0dbe29a78d6d9dd4a94c8f4f9edf8145..3cb5690f8e41a9563498209f009e62fd50bd2bcf 100644 (file)
@@ -163,6 +163,9 @@ class _WaitCancelFuture(_BaseWaitHandleFuture):
 
         self._done_callback = None
 
+    def cancel(self):
+        raise RuntimeError("_WaitCancelFuture must not be cancelled")
+
     def _schedule_callbacks(self):
         super(_WaitCancelFuture, self)._schedule_callbacks()
         if self._done_callback is not None:
@@ -693,6 +696,9 @@ class IocpProactor:
             # FIXME: Tulip issue 196: remove this case, it should not happen
             elif fut.done() and not fut.cancelled():
                 del self._cache[address]
+            elif isinstance(fut, _WaitCancelFuture):
+                # _WaitCancelFuture must not be cancelled
+                pass
             else:
                 try:
                     fut.cancel()