diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2016-05-13 19:58:00 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2016-05-13 19:58:00 (GMT) |
commit | 32dae3d50ff8f3ab5cbb36df476844ed41deb103 (patch) | |
tree | 805b4e05391596b4e6993869874e4c41b190c2a6 /Lib/asyncio/streams.py | |
parent | 04eb87e4ef3c821eddbefee83a9c009fea31af7f (diff) | |
download | cpython-32dae3d50ff8f3ab5cbb36df476844ed41deb103.zip cpython-32dae3d50ff8f3ab5cbb36df476844ed41deb103.tar.gz cpython-32dae3d50ff8f3ab5cbb36df476844ed41deb103.tar.bz2 |
asyncio: Break reference cycle in StreamReaderProtocol.connection_lost
Diffstat (limited to 'Lib/asyncio/streams.py')
-rw-r--r-- | Lib/asyncio/streams.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py index 0008d51..b7b0485 100644 --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -242,11 +242,14 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): self._loop.create_task(res) def connection_lost(self, exc): - if exc is None: - self._stream_reader.feed_eof() - else: - self._stream_reader.set_exception(exc) + if self._stream_reader is not None: + if exc is None: + self._stream_reader.feed_eof() + else: + self._stream_reader.set_exception(exc) super().connection_lost(exc) + self._stream_reader = None + self._stream_writer = None def data_received(self, data): self._stream_reader.feed_data(data) |