[Python-checkins] cpython (3.4): asyncio: Fix _ProactorBasePipeTransport.close()
victor.stinner
python-checkins at python.org
Thu Jan 15 13:42:38 CET 2015
https://hg.python.org/cpython/rev/a35b790a2db3
changeset: 94172:a35b790a2db3
branch: 3.4
user: Victor Stinner <victor.stinner at gmail.com>
date: Thu Jan 15 13:40:27 2015 +0100
summary:
asyncio: Fix _ProactorBasePipeTransport.close()
Set the _read_fut attribute to None after cancelling it.
This change should fix a race condition with
_ProactorWritePipeTransport._pipe_closed().
files:
Lib/asyncio/proactor_events.py | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -72,6 +72,7 @@
self._loop.call_soon(self._call_connection_lost, None)
if self._read_fut is not None:
self._read_fut.cancel()
+ self._read_fut = None
def _fatal_error(self, exc, message='Fatal error on pipe transport'):
if isinstance(exc, (BrokenPipeError, ConnectionResetError)):
@@ -93,9 +94,10 @@
self._conn_lost += 1
if self._write_fut:
self._write_fut.cancel()
+ self._write_fut = None
if self._read_fut:
self._read_fut.cancel()
- self._write_fut = self._read_fut = None
+ self._read_fut = None
self._pending_write = 0
self._buffer = None
self._loop.call_soon(self._call_connection_lost, exc)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list