Skip to content
Opensource internals
  • Posts

Cpython

CPython's Frame Implementation in C (types.FrameType)

Oct 20, 2026 7 min read Jay Hubbert

Every Python function call creates an activation record, commonly called a frame. It holds the code being executed, the local variables, the value stack, the globals/builtins, the …

PythonCpythonInternalsFrameFrames

Read more →

CPython's function Implementation in C

Oct 20, 2026 8 min read Jay Hubbert

A Python function is a PyFunctionObject — a shared code object bolted to a globals dict, a tuple of defaults, and a tuple of closure cells — and every call goes through vectorcall.

PythonCpythonInternalsFunction

Read more →

CPython's Generator Implementation in C (types.GeneratorType)

Oct 20, 2026 8 min read Jay Hubbert

Generators, coroutines, and async generators share one struct: an _PyInterpreterFrame embedded directly in the object, so a paused function is a single heap allocation.

PythonCpythonInternalsGeneratorGenerators

Read more →

CPython's int Implementation in C

Oct 20, 2026 8 min read Jay Hubbert

int is a PyObject with a tag word packing sign and digit count plus a little-endian array of 30-bit digits — and every value in -5..1024 is an immortal singleton.

PythonCpythonInternalsInt

Read more →

CPython's Iterator Implementation in C

Oct 20, 2026 8 min read Jay Hubbert

A for loop compiles to PyObject_GetIter plus repeated tp_iternext calls — two C function pointers, no Python-level dispatch for built-in types.

PythonCpythonInternalsIterator

Read more →

← Newer Page 4 of 11 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·