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.
(cherry picked from commit 80fda712c8)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
This commit is contained in:
Miss Islington (bot) 2019-01-07 18:15:25 -08:00 committed by GitHub
parent 9a413faa87
commit 88bd26a72e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -110,7 +110,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:

View File

@ -0,0 +1,2 @@
Fix ``asyncio.ProactorEventLoop.sendfile()``: don't attempt to set the result
of an internal future if it's already done.