Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue32610

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:asyncio.all_tasks() should return only non-finished tasks.
Type:Stage:resolved
Components:asyncioVersions:Python 3.8
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: asvetlov, lukasz.langa, miss-islington, yselivanov
Priority:release blockerKeywords:patch

Created on2018-01-21 16:45 byasvetlov, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 7174mergedyselivanov,2018-05-28 20:41
PR 7181mergedmiss-islington,2018-05-28 21:55
Messages (7)
msg310378 -(view)Author: Andrew Svetlov (asvetlov)*(Python committer)Date: 2018-01-21 16:45
Current behavior has a subtle pitfall.The function returns a list of *existing* tasks (not removed by decref or explicit call).If user's code has a strong reference to some task the task will be in return list for unpredictable amount of time, even if the task was done.Returning only *alive* tasks can make a function result more predictable (`not task.done()`).Opinions?
msg310379 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2018-01-21 16:49
I agree, returning done tasks is pretty useless.This is a new function so let's fix its behavour.  We need to:1. Document this difference between new asyncio.all_tasks() and now deprecated Task.all_tasks().2. Make sure that Task.all_tasks() works in 3.7 in the same way it was working before 3.7.
msg312907 -(view)Author: Andrew Svetlov (asvetlov)*(Python committer)Date: 2018-02-26 09:47
After re-thinking I come to another idea: let's keep `all_tasks()` behavior as is but add an `active_tasks()` function for returning all non-finished tasks.It should be done in Python 3.8
msg317921 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2018-05-28 20:44
After an off-list discussion I think I was able to convince Andrew to change the behaviour of the newly added asyncio.all_tasks() to return only pending tasks.  The logic behind this is that:1. there's no good known use case for returning a list of all non-GC-ed tasks; if such a case exists, it's easy to implement support for it via 'loop.set_task_factory'.2. OTOH, whenever one uses Task.all_task() they always want to filter out completed tasks.3. Since this is a new API, it makes sense to design it right and not strive for backwards compatibility with now deprecated asyncio.Task.all_tasks().
msg317927 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2018-05-28 21:54
New changeset416c1ebd9896b394790dcb4f9f035b1a44ebe9ff by Yury Selivanov in branch 'master':bpo-32610: Fix asyncio.all_tasks() to return only pending tasks. (GH-7174)https://github.com/python/cpython/commit/416c1ebd9896b394790dcb4f9f035b1a44ebe9ff
msg317928 -(view)Author: Yury Selivanov (yselivanov)*(Python committer)Date: 2018-05-28 21:55
Ned, this one would also be nice to have in 3.7.0.  The patch alters the behaviour of new 3.7 api.
msg317963 -(view)Author: miss-islington (miss-islington)Date: 2018-05-29 00:16
New changesetddc613f20394eba25f2420f6d2fa62b277c95058 by Miss Islington (bot) in branch '3.7':bpo-32610: Fix asyncio.all_tasks() to return only pending tasks. (GH-7174)https://github.com/python/cpython/commit/ddc613f20394eba25f2420f6d2fa62b277c95058
History
DateUserActionArgs
2022-04-11 14:58:56adminsetnosy: +lukasz.langa
github: 76791
2018-05-29 15:16:15yselivanovsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-05-29 00:16:46miss-islingtonsetnosy: +miss-islington
messages: +msg317963
2018-05-28 21:55:14miss-islingtonsetstage: patch review
pull_requests: +pull_request6816
2018-05-28 21:55:05yselivanovsetpriority: normal -> release blocker

messages: +msg317928
2018-05-28 21:54:04yselivanovsetmessages: +msg317927
2018-05-28 20:44:52yselivanovsetmessages: +msg317921
stage: patch review -> (no value)
2018-05-28 20:41:33yselivanovsetkeywords: +patch
stage: patch review
pull_requests: +pull_request6809
2018-02-26 09:47:19asvetlovsetmessages: +msg312907
versions: + Python 3.8, - Python 3.7
2018-01-21 16:49:12yselivanovsetmessages: +msg310379
2018-01-21 16:45:25asvetlovcreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp