asyncio: Fix _UnixWritePipeTransport, raise BrokenPipeError when the pipe is

closed, but only if there was pending write
This commit is contained in:
Victor Stinner 2014-01-31 13:04:28 +01:00
parent fcfb9461d3
commit 61b3c9bacc

View file

@ -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)