diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-01-31 12:04:28 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-01-31 12:04:28 (GMT) |
commit | 61b3c9bacc51a2dbf8baa4f55b812f33b32a2692 (patch) | |
tree | 7bc46615cea515abfa69531a081c83738dc313d2 | |
parent | fcfb9461d3cb726b3badee8ffdb6034f19882330 (diff) | |
download | cpython-61b3c9bacc51a2dbf8baa4f55b812f33b32a2692.zip cpython-61b3c9bacc51a2dbf8baa4f55b812f33b32a2692.tar.gz cpython-61b3c9bacc51a2dbf8baa4f55b812f33b32a2692.tar.bz2 |
asyncio: Fix _UnixWritePipeTransport, raise BrokenPipeError when the pipe is
closed, but only if there was pending write
-rw-r--r-- | Lib/asyncio/unix_events.py | 5 |
1 files changed, 4 insertions, 1 deletions
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) |