diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index 9b9e0aa7c7f..da204c69d45 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -111,7 +111,7 @@ def _fatal_error(self, exc, message='Fatal error on pipe transport'): self._force_close(exc) def _force_close(self, exc): - if self._empty_waiter is not None: + if self._empty_waiter is not None and not self._empty_waiter.done(): if exc is None: self._empty_waiter.set_result(None) else: diff --git a/Misc/NEWS.d/next/Library/2019-01-08-01-54-02.bpo-35682.KDM9lk.rst b/Misc/NEWS.d/next/Library/2019-01-08-01-54-02.bpo-35682.KDM9lk.rst new file mode 100644 index 00000000000..8152bd707ba --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-01-08-01-54-02.bpo-35682.KDM9lk.rst @@ -0,0 +1,2 @@ +Fix ``asyncio.ProactorEventLoop.sendfile()``: don't attempt to set the result +of an internal future if it's already done.