summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/streams.py
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2019-12-07 11:22:00 (GMT)
committerGitHub <noreply@github.com>2019-12-07 11:22:00 (GMT)
commit7ddcd0caa4c2e6b43265df144f59c5aa508a94f2 (patch)
tree2f9a44dcf250d2097551a5fce2d34cacdc74d5a2 /Lib/asyncio/streams.py
parentdec367261e7e2bb4dd42feeb58031abed2ade683 (diff)
downloadcpython-7ddcd0caa4c2e6b43265df144f59c5aa508a94f2.zip
cpython-7ddcd0caa4c2e6b43265df144f59c5aa508a94f2.tar.gz
cpython-7ddcd0caa4c2e6b43265df144f59c5aa508a94f2.tar.bz2
bpo-38529: Fix asyncio stream warning (GH-17474)
Diffstat (limited to 'Lib/asyncio/streams.py')
-rw-r--r--Lib/asyncio/streams.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
index 795530e..3c80bb8 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -214,8 +214,7 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
def __init__(self, stream_reader, client_connected_cb=None, loop=None):
super().__init__(loop=loop)
if stream_reader is not None:
- self._stream_reader_wr = weakref.ref(stream_reader,
- self._on_reader_gc)
+ self._stream_reader_wr = weakref.ref(stream_reader)
self._source_traceback = stream_reader._source_traceback
else:
self._stream_reader_wr = None
@@ -231,22 +230,6 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
self._over_ssl = False
self._closed = self._loop.create_future()
- def _on_reader_gc(self, wr):
- transport = self._transport
- if transport is not None:
- # connection_made was called
- context = {
- 'message': ('An open stream object is being garbage '
- 'collected; call "stream.close()" explicitly.')
- }
- if self._source_traceback:
- context['source_traceback'] = self._source_traceback
- self._loop.call_exception_handler(context)
- transport.abort()
- else:
- self._reject_connection = True
- self._stream_reader_wr = None
-
@property
def _stream_reader(self):
if self._stream_reader_wr is None: