Skip to content

Commit 1422011

Browse files
committed
add practical note re: garbage collection
1 parent 8adebdc commit 1422011

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Doc/howto/a-conceptual-overview-of-asyncio.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ For example, consider this program::
192192
Because the coroutine ``main()`` exits before awaiting the task and no other
193193
references to the task are made, the task object ``hello_task`` *might* be
194194
garbage collected before the event loop invokes it.
195+
Despite that, ``asyncio`` and Python's garbage collector work pretty hard
196+
to ensure this doesn't happen.
197+
But that's no reason to be reckless!
195198

196199
Since there's only one event loop (in each thread), :mod:`!asyncio` takes care of
197200
associating the task with the event loop for you. As such, there's no need

0 commit comments

Comments
 (0)