[Python-checkins] cpython (3.4): asyncio: IocpProactor.close() doesn't cancel anymore futures which are already

victor.stinner python-checkins at python.org
Thu Jan 22 22:58:44 CET 2015


https://hg.python.org/cpython/rev/7d5c23b87eae
changeset:   94240:7d5c23b87eae
branch:      3.4
parent:      94238:4f928c70f135
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Jan 22 22:47:13 2015 +0100
summary:
  asyncio: IocpProactor.close() doesn't cancel anymore futures which are already
cancelled

files:
  Lib/asyncio/windows_events.py |  10 +++++++---
  1 files changed, 7 insertions(+), 3 deletions(-)


diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py
--- a/Lib/asyncio/windows_events.py
+++ b/Lib/asyncio/windows_events.py
@@ -693,12 +693,16 @@
                 # 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()

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list