All notable changes to gopy are documented here.
The format is loosely based on Keep a Changelog and the project follows Semantic Versioning.
Each released version has a dated fragment in the changelog/
folder; this file is the aggregated index.
See changelog/v0.12.0.md.
- feat(optimizer): port the Tier-2 trace projector, executor
lifecycle, and analysis skeleton from
Python/optimizer.candPython/optimizer_analysis.c. Addsoptimizer/with the bloom filter, side table,AllocateExecutor/ExecutorInit/ detach / clear / pending deletion-list two-phase free, theJitOptContextlattice andAbstractFramearena,TranslateBytecodeToTraceprojection with itslookupMacroidentity fallback, the_START_EXECUTOR/_MAKE_WARM/_JUMP_TO_TOPprelude, and theprepare_for_executionexit / error stub split. - feat(optimizer/analysis): port the three-phase orchestrator
(
_Py_uop_analyze_and_optimize) plusremove_unneeded_uops. Drops_SET_IPand_CHECK_VALIDITYrows where escapes can be proved out of reach since_START_EXECUTOR, collapses the load-then-pop idiom, and resurrects_SET_IPahead of the next escaping uop. The per-opcode abstract-interpretation table (gated on the DSL generator) and the dict / type watcher arm (gated on watcher infrastructure) are deferred to follow-up work; the orchestrator runs the unwired phases as no-op stubs so the follow-ups slot in as body swaps. - feat(vm): wire
JUMP_BACKWARDandENTER_EXECUTOR. Every warm hit callstryWarmupTier2which routes throughoptimizer.Optimize; on success the install site flips toENTER_EXECUTORand subsequent hits land inenterExecutor. With no uop dispatcher yet, the arm deopts to the Tier-1 instruction the install path stashed inExecutor.VMData. - feat(objects/code): add
Code.Executorsside table for the per-install-site executor list. - feat(tools/uops_gen): scaffold the DSL generator. Parses
pycore_uop_ids.handpycore_uop_metadata.h, emitsoptimizer/uop_ids_gen.goandoptimizer/uop_meta_gen.go, and ships a drift check so the regenerated tables do not silently fall behind upstream. - fix(compile): encode
COMPARE_OPoparg with the comparison kind in the high bits, matching CPython's pre-specializer layout. Unblocks thecomparison_eqsmoke fixture deferred from v0.11. - chore: clean up gofmt, revive, staticcheck, and unparam findings across the tree.
See changelog/v0.11.0.md.
- feat(specialize): port the PEP 659 adaptive specializer.
Backoff counter and inline-cache layouts,
_PyCode_Quicken, the_PyOpcode_Cachesand_PyOpcode_Deopttables, plus per family ports ofLOAD_ATTR,STORE_ATTR,LOAD_GLOBAL,LOAD_SUPER_ATTR,BINARY_OP,COMPARE_OP,CONTAINS_OP,TO_BOOL,STORE_SUBSCR,UNPACK_SEQUENCE,FOR_ITER,SEND,CALL, andCALL_KW. Each family lands with its hit / miss / deopt path and thetp_version_tag/dk_versionguards the fast variants assume. - feat(vm): wire the specializer into dispatch. Quickened opcodes peel into the typed variant on hit, increment the per-cache counter, and fall back to the generic arm with the deopt counter primed.
- feat(monitor): port PEP 669
sys.monitoring. Per-interpreter state slab, the 19 fire-event entry points, the_Py_Instrumentshadow walk that rewrites quickened bytecode toINSTRUMENTED_*variants in place, the per-code tool-slot lifecycle (use_tool_id/free_tool_id/get_tool), line instrumentation driven by the PEP 626 line table, and the shared callback runner that honoursDisable/Missing. - feat(monitor): port the
sys.monitoringbuiltin module.use_tool_id,free_tool_id,get_tool,register_callback,set_events/get_events,set_local_events/get_local_events,restart_events, plus the event / tool constants and theDISABLE/MISSINGsingletons. - feat(vm): port
Python/legacy_tracing.c. The bridge registerssys.profileandsys.traceas PEP 669 tools 6 and 7 and translates the matching events into Go-levelLegacyTraceFunccallbacks shaped like CPython'sPy_tracefunc. Forward jumps returnDisableso the line handler takes over viaINSTRUMENTED_LINE. - feat(vm): wire
sys.settrace,sys.setprofile,sys.gettrace,sys.getprofile. Python callables ride through a Go trampoline shaped likeLegacyTraceFunc, then defer toSetTrace/SetProfileto install the bridge. - feat(frame): per-frame
TraceLines,TraceOpcodes, andLinenoslots so the bridge can drive line and opcode events on demand without paying for them at steady state. - feat(compile): regenerate the opcode table to pick up the
specialized variants (
LOAD_ATTR_INSTANCE_VALUE,BINARY_OP_ADD_INT, ...) and theINSTRUMENTED_*mirror set. - test(vmtest): v0.11 end-to-end gate (
v011_gate_test.go). Drives the specializer, the PEP 669 monitor fan-out, thesys.settracebridge, and thesys.monitoringbuiltin surface through their public entry points.
See changelog/v0.10.2.md.
- feat(parser/lexer): port the
goto nextlineflow fromParser/lexer/lexer.c. Blank and comment-only lines, plus newlines inside parens, no longer leak NEWLINE tokens to the parser; under tokenize-module mode they emit NL / COMMENT. - feat(parser/lexer): emit two
DOTtokens for..and reserveELLIPSISfor three;from ..pool import ThreadPoolnow lexes correctly. - feat(parser): surface pinned
SyntaxErrorfromrunParseinstead of masking it asErrParserNotImplemented. - feat(parser/pegen): fall back to
*math/big.Inton integer literals that overflowint64so e.g.0xffffffffffffffffparses. - feat(parser/pegen): bridge the alt-success / action-result split
via the
matchedOrhelper. Single-binding alts that bind a rule whose body returnednilno longer unwind the consumed tokens (fixes shapes likeclass B2():). - feat(parser/pegen): port the action helpers for
alias,global,nonlocal,lambda,with,match, andtypealias; fix off-by-one indexing incmpop_expr_pair,augoperator, andchecked_future_import; recognise thepair->key/pair->valueshape onDictComp. - feat(parser/pegen): port the f-string action helpers
(
joined_str,formatted_value,_PyPegen_check_fstring_conversion,_PyPegen_setup_full_format_spec) sof'{y!r}'andf'{y:>10}'parse and dump like CPython. - feat(parser/pegen): default the parser's
featureVersiontobuild.PythonMinorVersion; PEP 515 underscored literals (1_000_000,0xFFFF_FFFF) now parse without being rejected by thefeatureVersion < 6guard. - feat(tools/parser_gen): emit
matchedOr(...)wrappers around default-action and bare-bound-name returns; regeneratedparser_gen.gocarries 306 call sites. Route quoted operator literals through exact tokens. - feat(ast): port the rest of
Lib/ast.py(iter_fields,iter_child_nodes,walk,NodeVisitor,NodeTransformer,dump,parse,unparse,literal_eval) for tooling parity. - test(parser): differential CPython 3.14 parity gate
(
TestParserParity). Parses 50+ seeded fixtures with bothpython3and gopy and requiresast.dumpbyte-equality. CI installs Python 3.14 so the gate runs on ubuntu / macos / windows. - test(parser): full
Lib/test/test_grammar.pyparses end to end (TestParseTestGrammar). Corpus iteration over$CPYTHON/Libreaches ok=720 / sentinel=0 / fail=0 (100%), up from 10/720 in v0.10.1.
See changelog/v0.10.1.md.
- feat(builtins):
compile,eval,exec,__import__,open, plusmap/filteras real iterator types and the remainingaiter/anext/input/globals/locals/roundodds-and-ends fromPython/bltinmodule.c. - feat(objects):
__build_class__end to end soclass C(...): ...runs, with__slots__honored andsuper()driven by the__class__closure cell.memoryview,WeakSet/WeakValueDictionary/WeakKeyDictionary, weakrefproxyandCallableProxyType, the Python-levelframeandtracebacktypes, plusEllipsis,PyCapsule, andtypes.SimpleNamespace. - feat(objects):
_io.FilecollapsingRawIOBase/BufferedReader/TextIOWrapperinto one object - the layered split is a v0.11 follow-up. - feat(myreadline): port
Parser/myreadline.c-PyOS_Readlinedispatch through a swappableReaderhook, the uneditedStdioReadlinefallback, andErrInterruptfor Ctrl-C. The REPL loop now reads every prompt through this entry. - feat(vm):
GET_AWAITABLEplus the async-for opcodes;CLEANUP_THROWsurfacesStopIteration.valuesoyield fromterminates with the expected return value. - feat(errors): the remaining built-in exception classes - warnings,
syntax, os (errno-mapped), unicode, group, plus
FloatingPointError. - feat(compile):
SET_FUNCTION_ATTRIBUTEfor closure / defaults;LOAD_GLOBALwith name index packed into bits 1+. - feat(lexer): PEP 263 source-encoding cookie; sources are transcoded to UTF-8 before tokenization.
- feat(unicode):
PyUnicode_Format(%-style) end to end. - feat(imp):
imp.reload(module). - feat(gc):
set_debug/get_debug/get_stats/is_finalized, callback hooks,DEBUG_SAVEALLpopulatinggc.garbage, resurrection detection.
See changelog/v0.10.0.md.
- feat(gc): port the cycle collector.
gc_collect_mainruns end to end:update_refssnapshots refcounts,subtract_refswalkstp_traverseto surface intra-cycle references,move_unreachablepartitions the candidate set,handle_weakrefsclears weakrefs and queues callbacks,finalize_garbageruns PEP 442 finalizers, and survivors are promoted into the next generation. - feat(gc): three generations with the CPython default thresholds
(700 / 10 / 10), the permanent generation for
gc.freeze, and the per-referent weakref index on the collector state. - feat(gc):
gcbuiltin module surface.collect,enable,disable,isenabled,get_threshold,set_threshold,get_count,is_tracked,get_objects,get_referrers,get_referents,freeze,unfreeze,get_freeze_count, plusgarbageandcallbackslist attributes. - feat(objects):
TpTraverseslot onType.tuple,list,dict, andsetwalk their elements through the user-suppliedvisitproc. The collector uses this slot to discover intra-cycle edges. - feat(objects):
Weakref(weakref.ref) Python object withReferent,Callback,Clear, plusWeakrefTypecarrying theCallslot (returns the referent orNone),Repr, andHash.
See changelog/v0.9.0.md.
- feat(vm): generator opcodes (
RETURN_GENERATOR,YIELD_VALUE,SEND,GET_YIELD_FROM_ITER,CLEANUP_THROW); each generator runs on its own goroutine with buffered yield/send channels. - feat(vm): pattern-match opcodes (
MATCH_MAPPING,MATCH_SEQUENCE,MATCH_KEYS,MATCH_CLASS) plusWITH_EXCEPT_STARTand the async-iter / awaitable v0.9 stubs. - feat(vm):
BUILD_SET/SET_ADD/SET_UPDATEreal implementations;IMPORT_STARrouted throughCALL_INTRINSIC_1. - feat(vm): per-thread
gilSwitchTimerarmsBreakerGILDropRequestviapytime.Monotonic, mirroring CPython'stake_gilinterval. - feat(objects):
Generatortype plusTpFlagswithTpFlagMapping/TpFlagSequence. - feat(pytime): port
Python/pytime.c—Timetyped int64, rounding modes,Time_/Monotonic/PerfCounterclocks,Deadline,ClockInfo. - feat(hamt): port
Python/hamt.c— immutable hash-array mapped trie with structure sharing. - feat(contextvar): port
Python/context.cand the_contextvarsbuilt-in module —ContextVar,Context,Token,copy_context. - feat(getopt): port
Python/getopt.c—_PyOS_GetOpt; the CLI incmd/gopynow parses argv through it. - feat(hashtable): port
Python/hashtable.c— generic_Py_hashtable_tfor runtime infrastructure. - feat(tokenize): drive
Iterfrom the real lexer state machine.
See changelog/v0.8.0.md.
- feat(marshal):
TYPE_LONGdecoder,FLAG_REFback-references, interned-string tags,TYPE_CODEround-trip for the 3.11+ wire format,TYPE_SET/TYPE_FROZENSET/TYPE_DICT/TYPE_BINARY_COMPLEXencoding and decoding. - feat(marshal):
WritePyc/ReadPycimplement the PEP 552 16-byte.pycheader (timestamp and hash variants). - feat(codecs): codec registry (
Register/Lookup), built-in utf-8, ascii, and latin-1 codecs with alias normalization, andEncode/Decodeentry points. - feat(imp): frozen module table, sys.modules registry, inittab,
InitImportlibtwo-phase bootstrap sequence,ExecCodeModule, source and.pycloaders, andImportModuleLevelwith the sys.modules → frozen → built-in lookup chain. - feat(vm):
IMPORT_NAMEandIMPORT_FROMbytecode arms wired into the eval loop viavmExecutorimplementingimp.Executor. - feat(objects):
Moduletype,SetandFrozensettypes. - feat(errors):
ImportError/ModuleNotFoundErrorhierarchy.
See changelog/v0.7.0.md.
- feat(initconfig): port
Python/preconfig.c,Python/getenv.c, and thePyConfigsubset ofPython/initconfig.c. PyPreConfig and PyConfig with the three named initializers, env-var merge,_PyOS_GetOptplusconfig_parse_cmdline, and_PyConfig_Readwalking the precedence chain. - feat(pathconfig): port
Python/getpath.cfor darwin and linux. Resolves prefix / exec_prefix /sys.pathfrom the executable's location with the documented fallbacks. - feat(lifecycle): port
pylifecycle.cpyinit_core/pyinit_main/Py_FinalizeEx, plusModules/main.cPy_Mainas the unified entry that reads argv into PyConfig, inits, dispatches, finalizes. - feat(pythonrun): port
pythonrun.cPyRun_SimpleStringFlags,PyRun_AnyFileExFlags,PyRun_InteractiveLoopFlags, and the three-arm dispatch panel. The v0.6cmd/gopy -csmoke fixtures re-root ontopythonrun.RunString. - feat(errors): port
_PyErr_Printwith SystemExit short-circuit. - feat(sys): port the
_PySys_Createstatic attribute slice, the PyConfig-drivensys.argv/sys.path/sys.flagspanel, the runtime helpers (exit,getrecursionlimit,setrecursionlimit,getrefcount,intern,gettrace,settrace,getfilesystemencoding), andsys.implementationwith the gopycache_tag = "gopy-3140". - feat(builtins): port the iteration panel (
iter,next,enumerate,zip,range,reversed,map,filter), the reflection panel (type,isinstance,issubclass,id,hash,repr,len,callable), the attribute panel (getattr,hasattr,setattr,delattr), the aggregation panel (sum,min,max,any,all,sorted), the numeric / format panel (abs,divmod,pow,chr,ord,bin,oct,hex,ascii,format), and the constructor wrappers (int,float,bool,list,tuple,dict). PEP 515 underscore stripping inint(...)parsing. - feat(warnings): port
_warnings.c. Action / Category / Filter model,_PyWarnings_InitStateseeded defaults,_Py_Warndispatch, the per-module__warningregistry__dedup with the__once__bucket forActionOnce, and the user-facingsimplefilter/filterwarnings/resetwarningsfromLib/_py_warnings.py.
See changelog/v0.5.5.md.
- feat(parser/lexer): port
Parser/lexer/state.[ch],Parser/lexer/buffer.[ch], andParser/lexer/lexer.c. Regular mode FSM, INDENT / DEDENT, line continuation, PEP 701 f-strings, PEP 750 t-strings, COMMENT / NL / type-comment emission, plus string / file / readline drivers. - feat(parser/pegen): scaffold of
Parser/pegen.[ch]. Parser struct, fillToken, mark / reset / peek, Expect / ExpectName. Action helper shape ops (sequence, dotted-name, expr-context, expr-name table) fromParser/action_helpers.c. - feat(parser/errors): port of the SyntaxError text panel from
Parser/pegen_errors.cplus a small Build / Raise / RaiseRange surface and the lexer-errcode dispatch. - feat(parser/string): port of
Parser/string_parser.c. Prefix and quote stripping, escape decoding for unicode and bytes literals, raw / no-backslash fast paths.
See changelog/v0.5.0.md.
- feat(ast): port
Python-ast.c,ast.c,ast_preprocess.c, andast_unparse.c. Generated nodes fromPython.asdl, the full Validate panel (forbidden names, comprehension shape, expr_context, Starred placement, match-pattern shape, PEP 695 type-param), the 3.14 preprocess folds, and source round-trip. - feat(future): port
future.c. Detectsfrom __future__imports and surfaces feature flags to the rest of the pipeline. - feat(symtable): full port of
symtable.c. Build, analyse, errors panel, class name mangling. - feat(compile/instrseq): port
instruction_sequence.c. Sequence, Instr, label model, ApplyLabelMap. - feat(compile/codegen): port
codegen.c. Every statement and expression visitor needed for the v0.5 gate, including the eight match patterns, four comprehension kinds, with / async with, try / try*, the assignment-target panel, and TypeAlias via INTRINSIC_TYPEALIAS. - feat(compile/flowgraph): port of
flowgraph.c. CFG-driven pass driver, int-int BINARY_OP folding, jump threading, conditional-jump propagation, unreachable-block elimination, post-terminator dead code, redundant-NOP compaction. CFG-based stackdepth, swaptimize, super-instructions, LOAD_FAST ref-stack, and cold-block hoist remain for follow-on. - feat(compile/assemble): port of
assemble.c. EXTENDED_ARG widening, PEP 626 line table, PEP 657 exception table, type-keyed const dedup,co_qualnamewalk, fullco_flagsassembly. - feat(compile/compiler): top-level
Compileentry point that walks symtable, codegen, flowgraph, and assemble per scope. - feat(compile/dis): port of
dis.dis. Listings recombine EXTENDED_ARG prefixes and recurse into nested Code objects. - feat(marshal): version-5 wire format skeleton plus roundtrip test. Code-object marshal arm and CPython byte-parity land in v0.8.
- feat(tokenize): skeleton wrapper around
Python-tokenize.c. Type table generated fromGrammar/Tokensandpycore_token.h. The Iter / Token surface plus the lexer state machine arrive in v0.9. - test(v05test): cross-cut gate. Structural panel (empty, assign,
binary fold, load-after-store, if/while, def, async def). Ten
disassembly goldens (1629) under
testdata/golden/coveringempty_module,simple_assign,binary_add,load_after_store,if_pass,while_pass,def_add_one,async_def_pass,class_pass,type_alias. Refresh viago test -update.
See changelog/v0.4.0.md.
- feat(pystrconv): port
cpython/Python/pyctype.c,pystrcmp.c,mystrtoul.c,pystrhex.c, plus a Go-strconv-backed wrapper forpystrtod.canddtoa.c. ASCII classification, case-insensitive compare, hex encoding with separators, integer parsing with base autodetect, IEEE-754 ParseFloat, and FormatFloat covering ther/s/g/G/e/E/f/F/%codes with FloatFormatFlag. - feat(pymath): port
pymath.candpyfpe.c. CopySign, IsNaN, IsInf, IsFinite, Log1p, Hypot plus the FPE legacy sentinels. - feat(hash): full port of
pyhash.c. SipHash-1-3 Buffer, FNV-1a BufferFNV, KeyedHash, Pointer, Double, GetFuncDef, plus the numeric hash constants. Reference vectors against CPython under PYTHONHASHSEED=0. - feat(format): port
formatter_unicode.c. Spec parser plus FormatString, FormatInt, and FormatFloat covering the full[[fill]align][sign][z][#][0][width][,_][.precision][type]mini-language. - test(v04test): cross-cut gate that pins hash.Buffer, ParseFloat, FormatFloat, and format.FormatInt to CPython 3.14 reference values.
See changelog/v0.3.0.md.
- feat(errors): port
cpython/Python/errors.cand the gating subset ofcpython/Objects/exceptions.c. Set, SetString, Format, Occurred, Clear, Fetch, Restore, Raise, RaiseFrom, NormalizeException, Print, AttachTraceback. BaseException class hierarchy with KeyError str override. - feat(traceback): port
cpython/Python/traceback.cdata shape and formatting. Entry, Push, Format, FormatException. - feat(errors/suggest): port
cpython/Python/suggestions.c. SuggestAttr, SuggestKey backed by bounded Levenshtein distance. - feat(gc): refcount-only path of
cpython/Python/gc.c. Track, Untrack, RegisterFinalizer, Finalize. Cycle collection deferred to v0.10. - feat(brc): field layout from
cpython/Python/brc.c. Operations are no-ops in the GIL build; the queue drains land in v0.14. - feat(state): skeleton of
cpython/Python/pystate.c. Runtime, Interpreter, Thread with the per-thread exception slot. - feat(objects): v0.3 placeholder str so exception args round-trip through the protocol. Replaced by the unicodeobject port in v0.4.
See changelog/v0.2.0.md.
- feat(objects): land the v0.2 object protocol foundation. Header, VarHeader, Object interface, atomic refcount, Type with the v0.2 slot subset, C3 MRO.
- feat(objects): concrete builtins for the gate. int (with -5..256 cache), float, bool, None, NotImplemented, tuple (empty-tuple singleton, CPython-compatible tuplehash), list, dict (open-addressed with the CPython probing sequence), slice, range.
- feat(abstract): subset of
cpython/Objects/abstract.c. Length, GetItem, SetItem, Add, Subtract, Multiply, Iter, IterNext. - test(objtest): v0.2 gate harness. Build a dict, hash a tuple, iterate a list, plus smoke tests for caching, MRO, repr, range iteration.
See changelog/v0.1.0.md.
- build: bump minimum Go to 1.26.
- feat(arena): port
cpython/Python/pyarena.cto thearenapackage. - feat(pythread): port the cross-platform half of
cpython/Python/thread.cto thepythreadpackage. - feat(pysync): port
cpython/Python/lock.c,cpython/Python/parking_lot.c, andcpython/Python/critical_section.cto thepysyncpackage. - feat(hash): port the seed-init half of
cpython/Python/bootstrap_hash.cto thehashpackage.
See changelog/v0.0.0.md.
- Initial public scaffolding: Go module layout,
cmd/gopyentry point, staticbuildpackage, license, contribution guide, security policy, CI and release workflows.