diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-01-08 01:46:59 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-08 01:46:59 (GMT) |
commit | 80fda712c83f5dd9560d42bf2aa65a72b18b7759 (patch) | |
tree | 35b06401c85bb0f2dbb3fc514a6aa7e0854f8a12 | |
parent | fbf50683b3a2301097d5cd48bc68b530c1e1720f (diff) | |
download | cpython-80fda712c83f5dd9560d42bf2aa65a72b18b7759.zip cpython-80fda712c83f5dd9560d42bf2aa65a72b18b7759.tar.gz cpython-80fda712c83f5dd9560d42bf2aa65a72b18b7759.tar.bz2 |
bpo-35682: Fix _ProactorBasePipeTransport._force_close() (GH-11462)
bpo-32622, bpo-35682: Fix asyncio.ProactorEventLoop.sendfile(): don't
attempt to set the result of an internal future if it's already done.
Fix asyncio _ProactorBasePipeTransport._force_close(): don't set the
result of _empty_waiter if it's already done.
-rw-r--r-- | Lib/asyncio/proactor_events.py | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2019-01-08-01-54-02.bpo-35682.KDM9lk.rst | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index 9b9e0aa..da204c6 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -111,7 +111,7 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, 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 0000000..8152bd7 --- /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. |