summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/streams.py
diff options
context:
space:
mode:
authorKirill <iam@python273.pw>2022-08-27 19:32:01 (GMT)
committerGitHub <noreply@github.com>2022-08-27 19:32:01 (GMT)
commite860e521ec0d84e175269aeb15cf24bd6053ad17 (patch)
treed7ad039df160a113bbf6516aa806ca6eb6292e2c /Lib/asyncio/streams.py
parent6fbd889d6e937ad255f98b5495b78a06d05640d5 (diff)
downloadcpython-e860e521ec0d84e175269aeb15cf24bd6053ad17.zip
cpython-e860e521ec0d84e175269aeb15cf24bd6053ad17.tar.gz
cpython-e860e521ec0d84e175269aeb15cf24bd6053ad17.tar.bz2
gh-90467: StreamReaderProtocol - add strong reference to created task (#96323)
Diffstat (limited to 'Lib/asyncio/streams.py')
-rw-r--r--Lib/asyncio/streams.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py
index 9a16903..614b2cd 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -205,6 +205,7 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
self._strong_reader = stream_reader
self._reject_connection = False
self._stream_writer = None
+ self._task = None
self._transport = None
self._client_connected_cb = client_connected_cb
self._over_ssl = False
@@ -247,7 +248,7 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
res = self._client_connected_cb(reader,
self._stream_writer)
if coroutines.iscoroutine(res):
- self._loop.create_task(res)
+ self._task = self._loop.create_task(res)
self._strong_reader = None
def connection_lost(self, exc):
@@ -265,6 +266,7 @@ class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
super().connection_lost(exc)
self._stream_reader_wr = None
self._stream_writer = None
+ self._task = None
self._transport = None
def data_received(self, data):