Skip to main content

Specs

This is the canonical specification set for gopy. Each spec is a long-form plan for one part of the CPython port. We write the spec before the code, keep it in sync as the port lands, and use it as the source of truth when something behaves surprisingly.

Specs are split into two series:

  • The 1600 series covers the runtime port itself, organized by CPython subsystem. Each number maps to a slice of CPython's source tree: parser, compiler, VM, object protocol, GC, imports, codecs, and so on. If you want to know how a CPython function gets to Go, start here.
  • The 1700 series covers the test gate and porting workflow. It catalogs the end-to-end test corpus, tracks which subsystems have been audited for full ports, and records the lessons learned while vendoring CPython sources.

1600 series: runtime port

Foundations

Runtime infrastructure

Compile pipeline

Virtual machine

Parser

Strings, numbers, hashing

Objects

Imports, marshalling, codecs

Optimizer and instrumentation

1700 series: test gate and porting workflow

How to read a spec

Every spec follows the same shape:

  1. Goal. What problem the spec is solving and the constraint (usually "match CPython 1:1").
  2. Sources. The CPython files and line ranges the spec covers.
  3. Mapping. The Go names, packages, and field layouts the port uses, with the CPython equivalents alongside.
  4. Checklist (1700 series). The shipped vs. pending steps. We keep this current as work lands.
  5. Notes. Edge cases, surprises from the CPython source, and anything that diverged and why.

When a spec disagrees with the code, the code is right and the spec is the bug. We update the spec, not the runtime, unless the runtime itself is wrong.