From 61b3c9bacc51a2dbf8baa4f55b812f33b32a2692 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 31 Jan 2014 13:04:28 +0100 Subject: asyncio: Fix _UnixWritePipeTransport, raise BrokenPipeError when the pipe is closed, but only if there was pending write --- Lib/asyncio/unix_events.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/asyncio/unix_events.py b/Lib/asyncio/unix_events.py index ac764f8..98fddde 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) -- cgit v0.12