From: Victor Stinner Date: Thu, 22 Jan 2015 21:47:13 +0000 (+0100) Subject: asyncio: IocpProactor.close() doesn't cancel anymore futures which are already X-Git-Tag: v3.4.3rc1~100 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=752aba7f999b08c833979464a36840de8be0baf0;p=python asyncio: IocpProactor.close() doesn't cancel anymore futures which are already cancelled --- diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py index 3cb5690f8e..315455aa7c 100644 --- a/Lib/asyncio/windows_events.py +++ b/Lib/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()