8000 gh-90467: StreamReaderProtocol - add strong reference to created task by python273 · Pull Request #96323 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content
8000

gh-90467: StreamReaderProtocol - add strong reference to created task #96323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-90467: StreamReaderProtocol - add strong reference to created task
  • Loading branch information
python273 committed Aug 26, 2022
commit 91c8678d67bd5b726f001f3e2a0f6567a881ad2f
4 changes: 3 additions & 1 deletion Lib/asyncio/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def __init__(self, stream_reader, client_connected_cb=None, loop=None):
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
Expand Down Expand Up @@ -247,7 +248,7 @@ def connection_made(self, transport):
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):
Expand All @@ -265,6 +266,7 @@ def connection_lost(self, exc):
super().connection_lost(exc)
self._stream_reader_wr = None
self._stream_writer = None
self._task = None
self._transport = None

def data_received(self, data):
Expand Down
0