diff -r 4b5b233d4c98 Lib/asyncio/futures.py --- a/Lib/asyncio/futures.py Tue Oct 18 16:03:52 2016 -0400 +++ b/Lib/asyncio/futures.py Wed Oct 19 09:50:42 2016 +0900 @@ -244,16 +244,16 @@ change the future's state to cancelled, schedule the callbacks and return True. """ if self._state != _PENDING: return False self._state = _CANCELLED - self._schedule_callbacks() + self.__schedule_callbacks() return True - def _schedule_callbacks(self): + def __schedule_callbacks(self): """Internal: Ask the event loop to call all callbacks. The callbacks are scheduled to be called as soon as possible. Also clears the callback list. """ callbacks = self._callbacks[:] @@ -349,13 +349,13 @@ InvalidStateError. """ if self._state != _PENDING: raise InvalidStateError('{}: {!r}'.format(self._state, self)) self._result = result self._state = _FINISHED - self._schedule_callbacks() + self.__schedule_callbacks() def set_exception(self, exception): """Mark the future done and set an exception. If the future is already done when this method is called, raises InvalidStateError. @@ -366,13 +366,13 @@ exception = exception() if type(exception) is StopIteration: raise TypeError("StopIteration interacts badly with generators " "and cannot be raised into a Future") self._exception = exception self._state = _FINISHED - self._schedule_callbacks() + self.__schedule_callbacks() if compat.PY34: self._log_traceback = True else: self._tb_logger = _TracebackLogger(self, exception) # Arrange for the logger to be activated after all callbacks # have had a chance to call result() or exception(). diff -r 4b5b233d4c98 Lib/asyncio/windows_events.py --- a/Lib/asyncio/windows_events.py Tue Oct 18 16:03:52 2016 -0400 +++ b/Lib/asyncio/windows_events.py Wed Oct 19 09:50:42 2016 +0900 @@ -168,14 +168,19 @@ self._done_callback = None def cancel(self): raise RuntimeError("_WaitCancelFuture must not be cancelled") - def _schedule_callbacks(self): - super(_WaitCancelFuture, self)._schedule_callbacks() + def set_result(self, result): + super().set_result(result) + if self._done_callback is not None: + self._done_callback(self) + + def set_exception(self, exception): + super().set_exception(exception) if self._done_callback is not None: self._done_callback(self) class _WaitHandleFuture(_BaseWaitHandleFuture): def __init__(self, ov, handle, wait_handle, proactor, *, loop=None):