This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author simwr872
Recipients asvetlov, simwr872, yselivanov
Date 2022-01-08.23:35:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641684955.44.0.77228446083.issue46309@roundup.psfhosted.org>
In-reply-to
Content
Documentation states that a reference must be kept when creating a task, https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task.

This is not done in StreamReaderProtocol, https://github.com/python/cpython/blob/main/Lib/asyncio/streams.py#L244.

I've provided a simple example to force garbage collection of this task which results in `Task was destroyed but it is pending!`. Uncommenting the commented code of the example shows that the task is not destroyed when a reference is kept.

Am I missing something or using the library incorrectly? I've followed the examples at https://docs.python.org/3/library/asyncio-stream.html#tcp-echo-server-using-streams.
History
Date User Action Args
2022-01-08 23:35:55simwr872setrecipients: + simwr872, asvetlov, yselivanov
2022-01-08 23:35:55simwr872setmessageid: <1641684955.44.0.77228446083.issue46309@roundup.psfhosted.org>
2022-01-08 23:35:55simwr872linkissue46309 messages
2022-01-08 23:35:55simwr872create