Skip to content
Opensource internals
  • Posts

Generator

How CPython Implements async generators in C

Oct 20, 2026 5 min read Jay Hubbert

Python’s async def functions containing yield become async generators: objects that implement __anext__, asend, athrow and aclose. Unlike a regular generator, an async generator is …

PythonCpythonInternalsAsyncGenerator

Read more →

How CPython Implements Generator (types.GeneratorType) in C

Oct 20, 2026 7 min read Jay Hubbert

A Python generator is, at the C level, a single object that is its own frame: the executable state of a paused function lives inside the object, so a generator can be suspended, …

PythonCpythonInternalsGeneratorGenerators

Read more →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·