]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35682: Fix _ProactorBasePipeTransport._force_close() (GH-11462)
authorVictor Stinner <vstinner@redhat.com>
Tue, 8 Jan 2019 01:46:59 +0000 (02:46 +0100)
committerGitHub <noreply@github.com>
Tue, 8 Jan 2019 01:46:59 +0000 (02:46 +0100)
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.

Lib/asyncio/proactor_events.py
Misc/NEWS.d/next/Library/2019-01-08-01-54-02.bpo-35682.KDM9lk.rst [new file with mode: 0644]

index 9b9e0aa7c7f1e2d606f0524d07449ed7ba8e98ba..da204c69d45e32a44059ec2178b8d6f447e51082 100644 (file)
@@ -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 (file)
index 0000000..8152bd7
--- /dev/null
@@ -0,0 +1,2 @@
+Fix ``asyncio.ProactorEventLoop.sendfile()``: don't attempt to set the result
+of an internal future if it's already done.