diff options
author | Guido van Rossum <guido@dropbox.com> | 2015-07-14 13:06:47 +0200 |
---|---|---|
committer | Guido van Rossum <guido@dropbox.com> | 2015-07-14 13:06:47 +0200 |
commit | ce3ad816a2ef9456b4b1c26b99dfc85ea1236811 (patch) | |
tree | 4d6820bc4804a1c394e15be086bd9318c3b19492 | |
parent | 1f85dc7d6ba07d1a8be18446d251ebe5b7575d34 (diff) | |
download | trollius-git-ce3ad816a2ef9456b4b1c26b99dfc85ea1236811.tar.gz |
Return True from StreamReader.eof_received() to fix
http://bugs.python.org/issue24539 (but still needs a unittest). Add
StreamReader.__repr__() for easy debugging.
-rw-r--r-- | asyncio/streams.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/asyncio/streams.py b/asyncio/streams.py index 6cd60c4..902d1ca 100644 --- a/asyncio/streams.py +++ b/asyncio/streams.py @@ -240,6 +240,7 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): def eof_received(self): self._stream_reader.feed_eof() + return True class StreamWriter: @@ -321,6 +322,24 @@ class StreamReader: self._transport = None self._paused = False + def __repr__(self): + info = ['StreamReader'] + if self._buffer: + info.append('%d bytes' % len(info)) + if self._eof: + info.append('eof') + if self._limit != _DEFAULT_LIMIT: + info.append('l=%d' % self._limit) + if self._waiter: + info.append('w=%r' % self._waiter) + if self._exception: + info.append('e=%r' % self._exception) + if self._transport: + info.append('t=%r' % self._transport) + if self._paused: + info.append('paused') + return '<%s>' % ' '.join(info) + def exception(self): return self._exception |