]> granicus.if.org Git - python/commitdiff
asyncio: IocpProactor.close() doesn't cancel anymore futures which are already
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 22 Jan 2015 21:47:13 +0000 (22:47 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Thu, 22 Jan 2015 21:47:13 +0000 (22:47 +0100)
cancelled

Lib/asyncio/windows_events.py

index 3cb5690f8e41a9563498209f009e62fd50bd2bcf..315455aa7c4f9fbe981e4fafef6bc3616d669f97 100644 (file)
@@ -693,12 +693,16 @@ class IocpProactor:
                 # queues a task to Windows' thread pool.  This cannot
                 # be cancelled, so just forget it.
                 del self._cache[address]
-            # FIXME: Tulip issue 196: remove this case, it should not happen
-            elif fut.done() and not fut.cancelled():
-                del self._cache[address]
+            elif fut.cancelled():
+                # Nothing to do with cancelled futures
+                pass
             elif isinstance(fut, _WaitCancelFuture):
                 # _WaitCancelFuture must not be cancelled
                 pass
+            elif fut.done():
+                # FIXME: Tulip issue 196: remove this case, it should not
+                # happen
+                del self._cache[address]
             else:
                 try:
                     fut.cancel()