[Python-checkins] bpo-35682: Fix _ProactorBasePipeTransport._force_close() (GH-11462)

Miss Islington (bot) webhook-mailer at python.org
Mon Jan 7 21:15:29 EST 2019


https://github.com/python/cpython/commit/88bd26a72eb4ab341cf19bea78a0039fbe4be3a2
commit: 88bd26a72eb4ab341cf19bea78a0039fbe4be3a2
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-01-07T18:15:25-08:00
summary:

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 80fda712c83f5dd9560d42bf2aa65a72b18b7759)

Co-authored-by: Victor Stinner <vstinner at redhat.com>

files:
A Misc/NEWS.d/next/Library/2019-01-08-01-54-02.bpo-35682.KDM9lk.rst
M Lib/asyncio/proactor_events.py

diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index e350e8bc0c24..782c86106bce 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -110,7 +110,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 000000000000..8152bd707ba5
--- /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.



More information about the Python-checkins mailing list