Skip to content

v0.0.343: generator / coroutine introspection (gi_/cr_/ag_)#264

Merged
tamnd merged 1 commit into
mainfrom
feat/v0.0.343-generator-introspection
Apr 29, 2026
Merged

v0.0.343: generator / coroutine introspection (gi_/cr_/ag_)#264
tamnd merged 1 commit into
mainfrom
feat/v0.0.343-generator-introspection

Conversation

@tamnd

@tamnd tamnd commented Apr 29, 2026

Copy link
Copy Markdown
Owner

Summary

  • Generators, coroutines, and async generators now expose their introspection attrs (gi_* / cr_* / ag_*) — frame, code, running, suspended, yieldfrom/await, origin.
  • New Running flag on *object.Generator, set during resume/throw dispatch.
  • Closes F2 from the v0.1.0 audit. Spec: notes/Spec/1500/1537_goipy_v0043_generator_introspection.md. Fixture: internal/testdata/343_generator_introspection.py.

Test plan

  • go test ./... -timeout 600s green
  • Fixture 343 matches CPython
  • No regression on async / asyncio fixtures

Closes F2 from the v0.1.0 audit. *object.Generator backs all three
types; the prefix gi_ / cr_ / ag_ is picked from Code.Flags. Surfaced
attrs:

  *_frame    TracebackFrame{Code} while live, None after Done.
  *_code     underlying *object.Code.
  *_running  new Running flag set during resume/throw dispatch.
  gi_yieldfrom / cr_await / ag_await  None (no delegated tracking).
  gi_suspended  Started && !Done && !Running.
  cr_origin  None.

pytest-asyncio and trio gate test-fixture cleanup on cr_running so this
unblocks them. PEP 667 FrameLocalsProxy and yield-from tracking remain
out of scope.

Spec at notes/Spec/1500/1537_goipy_v0043_generator_introspection.md.
@tamnd tamnd merged commit 0089511 into main Apr 29, 2026
1 check passed
@tamnd tamnd deleted the feat/v0.0.343-generator-introspection branch April 29, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant