Issue32610
Created on 2018-01-21 16:45 by asvetlov, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 7174 | merged | yselivanov, 2018-05-28 20:41 | |
| PR 7181 | merged | miss-islington, 2018-05-28 21:55 | |
| Messages (7) | |||
|---|---|---|---|
| msg310378 - (view) | Author: Andrew Svetlov (asvetlov) * | 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) * | 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) * | 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) * | 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) * | Date: 2018-05-28 21:54 | |
New changeset 416c1ebd9896b394790dcb4f9f035b1a44ebe9ff 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) * | 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 changeset ddc613f20394eba25f2420f6d2fa62b277c95058 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 | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:56 | admin | set | nosy:
+ lukasz.langa github: 76791 |
| 2018-05-29 15:16:15 | yselivanov | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2018-05-29 00:16:46 | miss-islington | set | nosy:
+ miss-islington messages: + msg317963 |
| 2018-05-28 21:55:14 | miss-islington | set | stage: patch review pull_requests: + pull_request6816 |
| 2018-05-28 21:55:05 | yselivanov | set | priority: normal -> release blocker messages: + msg317928 |
| 2018-05-28 21:54:04 | yselivanov | set | messages: + msg317927 |
| 2018-05-28 20:44:52 | yselivanov | set | messages:
+ msg317921 stage: patch review -> (no value) |
| 2018-05-28 20:41:33 | yselivanov | set | keywords:
+ patch stage: patch review pull_requests: + pull_request6809 |
| 2018-02-26 09:47:19 | asvetlov | set | messages:
+ msg312907 versions: + Python 3.8, - Python 3.7 |
| 2018-01-21 16:49:12 | yselivanov | set | messages: + msg310379 |
| 2018-01-21 16:45:25 | asvetlov | create | |