Skip to content
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

asyncio Task._fut_waiter done callback #81462

Closed
ghost opened this issue Jun 14, 2019 · 5 comments
Closed

asyncio Task._fut_waiter done callback #81462

ghost opened this issue Jun 14, 2019 · 5 comments
Labels
3.7 (EOL) end of life topic-asyncio type-bug An unexpected behavior, bug, or error

Comments

@ghost
Copy link

ghost commented Jun 14, 2019

BPO 37281
Nosy @asvetlov, @1st1

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2019-06-14.11:15:23.540>
created_at = <Date 2019-06-14.10:32:18.328>
labels = ['type-bug', '3.7', 'expert-asyncio']
title = 'asyncio Task._fut_waiter done callback'
updated_at = <Date 2019-06-14.11:15:23.539>
user = None

bugs.python.org fields:

activity = <Date 2019-06-14.11:15:23.539>
actor = '\xd0\x92\xd0\xb0\xd0\xbb\xd0\xb5\xd0\xbd\xd1\x82\xd0\xb8\xd0\xbd \xd0\x91\xd1\x83\xd1\x80\xd1\x87\xd0\xb5\xd0\xbd\xd1\x8f'
assignee = 'none'
closed = True
closed_date = <Date 2019-06-14.11:15:23.540>
closer = '\xd0\x92\xd0\xb0\xd0\xbb\xd0\xb5\xd0\xbd\xd1\x82\xd0\xb8\xd0\xbd \xd0\x91\xd1\x83\xd1\x80\xd1\x87\xd0\xb5\xd0\xbd\xd1\x8f'
components = ['asyncio']
creation = <Date 2019-06-14.10:32:18.328>
creator = '\xd0\x92\xd0\xb0\xd0\xbb\xd0\xb5\xd0\xbd\xd1\x82\xd0\xb8\xd0\xbd \xd0\x91\xd1\x83\xd1\x80\xd1\x87\xd0\xb5\xd0\xbd\xd1\x8f'
dependencies = []
files = []
hgrepos = []
issue_num = 37281
keywords = []
message_count = 5.0
messages = ['345575', '345578', '345582', '345584', '345586']
nosy_count = 3.0
nosy_names = ['asvetlov', 'yselivanov', '\xd0\x92\xd0\xb0\xd0\xbb\xd0\xb5\xd0\xbd\xd1\x82\xd0\xb8\xd0\xbd \xd0\x91\xd1\x83\xd1\x80\xd1\x87\xd0\xb5\xd0\xbd\xd1\x8f']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue37281'
versions = ['Python 3.7']

@ghost
Copy link
Author

ghost commented Jun 14, 2019

Future has a done_callback, but Task not, why ?
Is a safe to use Task._fut_waiter future done_callback?

Repository owner added 3.7 (EOL) end of life type-bug An unexpected behavior, bug, or error labels Jun 14, 2019
@asvetlov
Copy link
Contributor

  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.

@ghost
Copy link
Author

ghost commented Jun 14, 2019

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.

@asvetlov
Copy link
Contributor

See bpo-32363

@ghost
Copy link
Author

ghost commented Jun 14, 2019

Thanks

Repository owner closed this as completed Jun 14, 2019
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.7 (EOL) end of life topic-asyncio type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants