Skip to content
Opensource internals
  • Posts

Cpython

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 bool in C

Oct 20, 2026 · 6 min read · Jay Hubbert

Python’s bool is unusual: it is a real type, but there are exactly two instances, True and False, and they are also the integers 1 and 0. In CPython that is implemented in …

PythonCpythonInternalsBool

Read more →

How CPython Implements Bound Methods (types.MethodType) in C

Oct 20, 2026 · 7 min read · Jay Hubbert

Python’s bound method – the object you get from obj.method and what types.MethodType names – is implemented in CPython in Objects/classobject.c as a small GC-tracked struct holding …

PythonCpythonInternalsMethod

Read more →

How CPython Implements bytearray in C

Oct 20, 2026 · 7 min read · Jay Hubbert

Python’s bytearray is the mutable cousin of bytes: a sequence of raw bytes you can grow, shrink and overwrite in place. In CPython that is implemented by PyByteArrayObject in …

PythonCpythonInternalsBytearray

Read more →

How CPython Implements bytes in C

Oct 20, 2026 · 6 min read · Jay Hubbert

Python’s bytes is an immutable sequence of bytes. In CPython it is implemented by PyBytesObject in Objects/bytesobject.c, a variable-size object whose payload is a single trailing …

PythonCpythonInternalsBytes

Read more →

← Newer Page 1 of 11 Older →

© 2026 Jay Hubbert · Built with Hugo 0.168.0

RSS ·