[Python-checkins] cpython: asyncio: Fix _ProactorWritePipeTransport._pipe_closed()

victor.stinner python-checkins at python.org
Tue Feb 4 09:26:12 CET 2014


http://hg.python.org/cpython/rev/632ff061636b
changeset:   88951:632ff061636b
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Feb 04 08:57:48 2014 +0100
summary:
  asyncio: Fix _ProactorWritePipeTransport._pipe_closed()

Do nothing if the pipe is already closed. _loop_writing() may call
_force_close() when it gets ConnectionResetError.

files:
  Lib/asyncio/proactor_events.py |  5 ++++-
  1 files changed, 4 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
@@ -304,9 +304,12 @@
         if fut.cancelled():
             # the transport has been closed
             return
+        assert fut.result() == b''
+        if self._closing:
+            assert self._read_fut is None
+            return
         assert fut is self._read_fut, (fut, self._read_fut)
         self._read_fut = None
-        assert fut.result() == b''
         if self._write_fut is not None:
             self._force_close(exc)
         else:

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list