Repository navigation
gh-162395: Fix awaited-by links for asyncio.shield() - #162396
deadlovelll wants to merge 2 commits into
Conversation
asvetlov
left a comment
There was a problem hiding this comment.
Thanks for the PR.
Please address comments
| futures.future_add_to_awaited_by(inner, cur_task) | ||
| else: | ||
| cur_task = None | ||
| futures.future_add_to_awaited_by(inner, outer) |
There was a problem hiding this comment.
When outer is consumed by wait(), gather() or add_done_callback(), nothing records an awaiter for it. The graph now ends at an orphan F, where before it pointed at the task that called shield(). Example: await asyncio.wait([asyncio.shield(t)]). Could we keep a current_task() fallback for that case, and add a test for it?
| cur_task = None | ||
| futures.future_add_to_awaited_by(inner, outer) | ||
|
|
||
| def _clear_awaited_by_callback(inner): |
There was a problem hiding this comment.
Nit: since outer is always set now, this can be a single discard call at the top of _inner_done_callback.
| ] | ||
| ]) | ||
|
|
||
| async def test_shield_awaited_by_different_task(self): |
There was a problem hiding this comment.
Please add a test where the consumer is cancelled while inner is still pending, then check that capture_call_graph(child).awaited_by is empty.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Fix awaited-by links for asyncio.shield()
See gh-162395