summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-01-22 09:24:03 +0100
committerVictor Stinner <victor.stinner@gmail.com>2015-01-22 09:24:03 +0100
commit6973d095a461e7225e524407f6450642d877f8e8 (patch)
tree804fc9bcc1cb1ffe3ba0c3ade0c62df594097003
parent5d7bbcf567230dcfa8a419b1a0d462566c65ab83 (diff)
downloadtrollius-6973d095a461e7225e524407f6450642d877f8e8.tar.gz
IocpProactor.close(): don't cancel futures which are already cancelled
-rw-r--r--asyncio/windows_events.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/asyncio/windows_events.py b/asyncio/windows_events.py
index 3cb5690..315455a 100644
--- a/asyncio/windows_events.py
+++ b/asyncio/windows_events.py
@@ -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()