Skip to content

gh-156408: Fix asyncio.print_call_graph() on a finished task - #156410

Open
deadlovelll wants to merge 1 commit into
python:mainfrom
deadlovelll:gh-156408-finished-task
Open

gh-156408: Fix asyncio.print_call_graph() on a finished task#156410
deadlovelll wants to merge 1 commit into
python:mainfrom
deadlovelll:gh-156408-finished-task

Conversation

@deadlovelll

Copy link
Copy Markdown
Contributor

Fix asyncio.print_call_graph() on a finished task

For more details see gh-156408

Comment thread Lib/asyncio/graph.py
elif hasattr(coro, 'ag_await'):
# A native async generator or duck-type compatible iterator
st.append(FrameCallGraphEntry(coro.ag_frame))
coro = coro.ag_await

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line has the same pattern as you fixed above, should we check if it's None here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi! Suspended async generator always have it's frame, because it's cleared only when the generator finishes

We only get into this branch while a task is suspended inside the generator, so the generator is still alive and always has a frame

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants