summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-08-30 10:59:32 (GMT)
committerGitHub <noreply@github.com>2022-08-30 10:59:32 (GMT)
commit126ec34558ef9e2fd688cc85b0951b559ce6a889 (patch)
tree4cee62d50ebb10ad9a19dfffbb3cf04d88e345d1 /Lib
parent16d8948c31537355f64f38de4f4ebc4ef5b9e7b8 (diff)
downloadcpython-126ec34558ef9e2fd688cc85b0951b559ce6a889.zip
cpython-126ec34558ef9e2fd688cc85b0951b559ce6a889.tar.gz
cpython-126ec34558ef9e2fd688cc85b0951b559ce6a889.tar.bz2
gh-90467: StreamReaderProtocol - add strong reference to created task (GH-96323) (#96344)
(cherry picked from commit e860e521ec0d84e175269aeb15cf24bd6053ad17) Co-authored-by: Kirill <iam@python273.pw> Co-authored-by: Kirill <iam@python273.pw>
Diffstat (limited to 'Lib')
-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 a568c4e..af78e6b 100644
--- a/Lib/asyncio/streams.py
+++ b/Lib/asyncio/streams.py
@@ -206,6 +206,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
@@ -248,7 +249,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):
@@ -266,6 +267,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):