-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
The aiohttp_fetch.py example file makes use of the @asyncSlot()
decorator to allow passing the on_btnFetch_clicked
async function to the .connect
method of a button.
Under the covers, @asyncSlot()
is just creating a Task
object using asyncio.ensure_future()
. In the documentation for that function, it says "Save a reference to the result of this function, to avoid a task disappearing mid-execution.". It seems that the example code does not do this, so may be liable for garbage-collection issues if the now reference-less task is cleaned up unexpectedly.
Is there a preferred pattern to use for these decorators? Or can the decorator be modified to keep a reference to the Task that is created?
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers