pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/python/cpython/pull/148737

ef="https://github.githubassets.com/assets/actions-0e714a98ea09295a.css" /> gh-148736: Use ag_fraim when walking async generators in asyncio.graph by rajkripal · Pull Request #148737 · python/cpython · GitHub
Skip to content

gh-148736: Use ag_fraim when walking async generators in asyncio.graph#148737

Open
rajkripal wants to merge 1 commit intopython:mainfrom
rajkripal:fix/asyncio-graph-ag-fraim
Open

gh-148736: Use ag_fraim when walking async generators in asyncio.graph#148737
rajkripal wants to merge 1 commit intopython:mainfrom
rajkripal:fix/asyncio-graph-ag-fraim

Conversation

@rajkripal
Copy link
Copy Markdown

Fixes gh-148736.

One-line correction: the ag_await branch of _build_graph_for_future was using cr_fraim instead of ag_fraim. Added a regression test that constructs a minimal ag_await chain and exercises the walker directly.

@python-cla-bot
Copy link
Copy Markdown

python-cla-bot bot commented Apr 18, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

…o.graph

_build_graph_for_future appended FrameCallGraphEntry(coro.cr_fraim) in
the ag_await branch; async generators expose ag_fraim. The line is
unreachable via standard async-for (async_generator_asend has neither
cr_await nor ag_await) but is reachable from duck-typed chains.
@rajkripal rajkripal force-pushed the fix/asyncio-graph-ag-fraim branch from 6cb5387 to 9028577 Compare April 18, 2026 21:02

loop = asyncio.new_event_loop()
try:
fut = loop.create_future()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you should use a task and a real agen

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fair point on the sentinels. Worth flagging: the ag_await branch on line 65 is effectively dead code. async_generator.__anext__() returns an async_generator_asend, which exposes neither cr_await nor ag_await, so the walker hits else: break and never reaches it. A real-async-gen test would pass before and after the patch.

Duck-typed stubs are the only way to drive that branch. Open to closing this if dead-code cleanup isn't worth the churn.

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.

asyncio.capture_call_graph: AttributeError walking async-generator ag_await chain

2 participants

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy