From: Victor Stinner Date: Fri, 31 Jan 2014 12:04:28 +0000 (+0100) Subject: asyncio: Fix _UnixWritePipeTransport, raise BrokenPipeError when the pipe is X-Git-Tag: v3.4.0rc1~163 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=61b3c9bacc51a2dbf8baa4f55b812f33b32a2692;p=thirdparty%2FPython%2Fcpython.git asyncio: Fix _UnixWritePipeTransport, raise BrokenPipeError when the pipe is closed, but only if there was pending write --- diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index ac764f8ad56c..98fdddeec98c 100644 --- a/Lib/asyncio/unix_events.py +++ b/Lib/asyncio/unix_events.py @@ -283,7 +283,10 @@ class _UnixWritePipeTransport(selector_events._FlowControlMixin, def _read_ready(self): # Pipe was closed by peer. - self._close() + if self._buffer: + self._close(BrokenPipeError()) + else: + self._close() def write(self, data): assert isinstance(data, (bytes, bytearray, memoryview)), repr(data)