Open-Source Wikis

/

CPython

/

Lore

python/cpython

Lore

A timeline of the CPython codebase. Where exact dates are unclear, the month of the relevant tag or earliest related commit is used.

Note: most "why" rationale is not in commit messages. Where the reasoning is uncertain we use hedging language ("appears to", "likely") and link to the relevant PEP.

Eras

The early years (Aug 1990 – ~2000)

The first commit, Initial revision, is dated 9 August 1990, and the very next commits add a tutorial and a module reference (tut, mod) and PostScript-output tooling. The tree at that point is already recognisably "Python": a Modules/, Objects/, Parser/, and Doc/. The directory layout you still see today (Python/ceval.c, Objects/longobject.c, Modules/posixmodule.c) was set in stone in this era.

The CPython 2.x era (~2000 – Dec 2008)

The repository continued under SourceForge, then Mercurial. Major language changes (generators, with, decorators, new-style classes) all landed in this era. Python 2.0 released in 2000; the last 2.x release, 2.7, was tagged in 2010 and end-of-lifed in 2020. Code from this era still survives in many low-level files — for example the bones of Python/ceval.c, Modules/posixmodule.c, and the LL(1) grammar.

The 3.x transition (Dec 2008 – ~2015)

Python 3.0 released in December 2008. The tree absorbed a long-running parallel branch and the codebase started shedding 2-only assumptions. Examples visible today: the str/bytes split throughout Objects/, the unification of int and long in Objects/longobject.c (originally split as intobject.c/longobject.c), and the rewrite of the I/O stack in Modules/_io/.

Move to GitHub and modernization (Feb 2017 – present)

CPython moved from Mercurial to GitHub in early 2017. The CODEOWNERS file, the Misc/NEWS.d/ "blurb" workflow, and the GitHub-Actions CI under .github/workflows/ all date from that switch.

The PEG parser (Oct 2020, 3.9)

PEP 617 replaced the LL(1) parser with a PEG parser. The grammar moved to Grammar/python.gram and the parser became a generated artifact. The old pgen tool was removed. This is the largest single change to the front of the compilation pipeline in CPython's history.

Faster CPython (May 2021, 3.11+)

Starting with 3.11 (Oct 2022) the "Faster CPython" project introduced the adaptive interpreter (Python/specialize.c), inline caches, and zero-cost exception handling. The old "stack of try blocks" became an exception table on each code object — see InternalDocs/exception_handling.md. Frame layout changed dramatically (it now lives in the interpreter's data stack); this is documented in InternalDocs/frames.md.

Subinterpreters and PEP 684 (Oct 2023, 3.12)

PEP 684 gave each interpreter its own GIL. State that used to be process-global (small-int cache, builtins, allocators) was carved out per-PyInterpreterState. The plumbing lives in Python/crossinterp.c, Python/pystate.c, and the _interpreters, _interpchannels, _interpqueues modules under Modules/.

The tier-2 micro-op interpreter and JIT (Oct 2024, 3.13+)

The tier-2 interpreter introduced micro-ops as a smaller, more uniform IR for hot traces. A copy-and-patch JIT — described in Haoran Xu's article — emits machine code from stencils generated at build time by Tools/jit/. Both are still gated behind --enable-experimental-jit. See JIT and InternalDocs/jit.md. This is the single most active area of CPython development today (see By the numbers).

Free threading / nogil (Oct 2024, 3.13+)

PEP 703 is being implemented under the --disable-gil build flag. The most visible code is Python/gc_free_threading.c, Python/qsbr.c, Python/lock.c, and the new mimalloc-based small-object allocator at Objects/mimalloc/. The cycle collector has been forked into a free-threaded variant; the GIL build still uses the original Python/gc.c.

Longest-standing features

These are the parts of the tree whose general shape and home file have been stable across many decades:

Feature First appeared Where it lives now
posix/os C bindings 1990 Modules/posixmodule.c — still the largest file in the tree (~19k lines).
Bytecode interpreter 1990 Python/ceval.c (the giant switch was relocated, but the file kept its name).
Object protocol 1990 Objects/object.c.
unicode / str Python 1.6 (2000) — refactored in 3.3 (PEP 393) Objects/unicodeobject.c.
dict 1990 — heavily rewritten over the years (compact dicts in 3.6) Objects/dictobject.c.

Major rewrites and replacements

Replaced With When
The hand-written I/O layer (Lib/io.py) The C _io module (Modules/_io/) 3.0 (Dec 2008)
intobject.c + longobject.c (separate types) A single int in Objects/longobject.c 3.0
The LL(1) parser + pgen The PEG parser (Parser/parser.c) 3.9 (Oct 2020)
The "stack of try blocks" exception model Per-code-object exception tables 3.11 (Oct 2022)
The classic frame on the C stack _PyInterpreterFrame in the interpreter's own data stack 3.11 (Oct 2022)
pymalloc only pymalloc (default) + mimalloc (free-threaded builds) 3.13 (Oct 2024)
Single gc.c gc.c for the GIL build, gc_free_threading.c for --disable-gil 3.13 (Oct 2024)

Deprecated and removed in the last few releases

A non-exhaustive list maintained here for orientation; full notes live under Doc/whatsnew/3.*.rst and Doc/deprecations/.

  • distutils — removed in 3.12 (long deprecated). External setuptools is the replacement.
  • asynchat, asyncore, smtpd — removed in 3.12.
  • imp — removed in 3.12; replaced by importlib.
  • binhex — removed in 3.11.
  • nis, crypt, pipes, aifc, audioop, chunk, cgi, cgitb, mailcap, msilib, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib — scheduled for removal under PEP 594, most gone by 3.13.
  • smtpd — removed; aiosmtpd is the replacement.

Growth trajectory

The repository now sees roughly 85 commits per week. The interpreter core, the JIT, and the free-threaded build are by far the most active areas (see By the numbers). The standard library still grows slowly — recent additions include tomllib (3.11) and substantial rework of pathlib (3.13), but most stdlib commits are bug fixes rather than new modules.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Lore – CPython wiki | Factory