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.

classification
Title: asyncio Task._fut_waiter done callback
Type: behavior Stage: resolved
Components: asyncio Versions: Python 3.7
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: asvetlov, yselivanov, Валентин Бурченя
Priority: normal Keywords:

Created on 2019-06-14 10:32 by Валентин Бурченя, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg345575 - (view) Author: Валентин Бурченя (Валентин Бурченя) Date: 2019-06-14 10:32
Future has a done_callback, but Task not, why ?
Is a safe to use Task._fut_waiter future done_callback?
msg345578 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-06-14 10:44
1. Task._fut_waiter is a private API, please avoid it
2. Task class is derived from Future, thus it HAS add_done_callback() method. The other question is that from my experience if the application-level code uses add_done_callback() the design is not perfect and error-prone. add_done_callback() is useful for relatively low-level libraries.
msg345582 - (view) Author: Валентин Бурченя (Валентин Бурченя) Date: 2019-06-14 11:04
Sorry, you right! But why not set_result and set_exception?
My code: waiter_task.add_done_callback(lambda f: f.result()) because i don't wont to store my running tasks in the array but i must query awaiteable for the result.
Thank you for a reply.
msg345584 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2019-06-14 11:09
See bpo-32363
msg345586 - (view) Author: Валентин Бурченя (Валентин Бурченя) Date: 2019-06-14 11:15
Thanks
History
Date User Action Args
2022-04-11 14:59:16adminsetgithub: 81462
2019-06-14 11:15:23Валентин Бурченяsetstatus: open -> closed

messages: + msg345586
stage: resolved
2019-06-14 11:09:33asvetlovsetmessages: + msg345584
2019-06-14 11:04:58Валентин Бурченяsetmessages: + msg345582
2019-06-14 10:44:26asvetlovsetmessages: + msg345578
2019-06-14 10:38:02xtreaksetnosy: + asvetlov, yselivanov
components: + asyncio
2019-06-14 10:32:18Валентин Бурченяcreate