Skip to content
Opensource internals
  • Posts

Cpython

How CPython Implements Cell (types.CellType) in C

Oct 20, 2026 9 min read Jay Hubbert

Python’s cell – the object exposed as types.CellType and the thing that makes nonlocal (and closures) work – is implemented in CPython in Objects/cellobject.c as a tiny GC-tracked …

PythonCpythonInternalsCell

Read more →

How CPython Implements code in C

Oct 20, 2026 8 min read Jay Hubbert

Python’s code type (types.CodeType) is the compiled representation of a function body, class body, or module: it holds the bytecode, constants, names, variable layout, source …

PythonCpythonInternalsCode

Read more →

How CPython Implements complex in C

Oct 20, 2026 7 min read Jay Hubbert

Python’s complex is a fixed-size value type: two C doubles, one for the real part and one for the imaginary part. There is no arbitrary precision and no digit array, unlike int. In …

PythonCpythonInternalsComplex

Read more →

How CPython Implements coroutine in C

Oct 20, 2026 6 min read Jay Hubbert

Python’s coroutine type (types.CoroutineType, the object an async def function returns when called) is not a separate implementation: there is no coroutineobject.c. CPython reuses …

PythonCpythonInternalsCoroutine

Read more →

How CPython Implements Descriptors (property, classmethod, staticmethod, and generic descriptors) in C

Oct 20, 2026 8 min read Jay Hubbert

Descriptors are the mechanism behind property, classmethod, staticmethod, slots, and most of the attributes you read off classes. In CPython they are not a separate object …

PythonCpythonInternalsDescriptorProperty

Read more →

← Newer Page 2 of 11 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·