Skip to content

gh-156980: Fix asyncio call graph truncation at async generators - #156984

Open
deadlovelll wants to merge 1 commit into
python:mainfrom
deadlovelll:gh-156980-asyncgen
Open

deadlovelll wants to merge 1 commit into
python:mainfrom
deadlovelll:gh-156980-asyncgen

Conversation

@deadlovelll

Copy link
Copy Markdown
Contributor

Fix asyncio call graph truncation at async generators

For more details see gh-156980

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #34408068 | 📁 Comparing 094fdb7 against main (e620377)

  🔍 Preview build  

2 files changed
± library/stdtypes.html
± whatsnew/changelog.html

@msullivan msullivan left a comment

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.

This looks good to me!

Comment thread Doc/library/stdtypes.rst
Comment on lines +1241 to +1248
The awaitables returned by :meth:`~agen.asend`, :meth:`~agen.athrow` and
:meth:`~agen.aclose` expose the generator they drive as a read-only
``ag_gen`` attribute.

.. versionadded:: 3.16
The ``ag_gen`` attribute.


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.

Probably document it in Doc/library/inspect.rst, rather than here, I think.

@1st1 1st1 left a comment

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.

I don't think this is controversial at all and it can help with building better debugging tools.

@1st1

1st1 commented Oct 7, 2026

Copy link
Copy Markdown
Member

@pablogsal @ambv -- this one is beneficial for async introspection, can we backport it?

Comment thread Objects/genobject.c
}

static PyMemberDef async_gen_asend_memberlist[] = {
{"ag_gen", Py_T_OBJECT_EX, offsetof(PyAsyncGenASend, ags_gen), Py_READONLY},

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.

Oh, maybe do we want to call the field ags_gen?

I don't feel strongly at all though.

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.

Actually probably nevermind: I think it's good to have the throw and send ones use the same name.

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.

3 participants