Tags: tamnd/gopy
Tags
v0.9.0: vm tail, contextvars, and the runtime time layer This is the release that closes out the Tier-1 dispatch panel. After v0.9 every bytecode the compiler routinely emits has a real arm in the eval loop. Generators run on their own goroutine and synchronise with the caller through buffered channels. RETURN_GENERATOR detaches the current frame from the chunk arena and spawns the goroutine; SEND, YIELD_VALUE, and CLEANUP_THROW route through that channel pair. Pattern matching covers all four MATCH_* opcodes, including the __match_args__ extraction path. Set builders, IMPORT_STAR, and WITH_EXCEPT_START are also live. Three packages land underneath the vm work. hamt is the immutable hash-array mapped trie that backs contextvars.Context. contextvar implements PEP 567 set/reset semantics with copy-on-write. pytime gives the runtime a real nanosecond clock layer (with rounding modes matching CPython byte-for-byte) and that clock now powers the GIL switch interval through a per-thread gilSwitchTimer. Two more pieces of infrastructure close out the small-runtime shelf: getopt replaces the ad-hoc CLI switch in cmd/gopy with a real POSIX-style argv walker, and hashtable provides the generic hash table that runtime code needs outside the dict object. tokenize.Iter graduates from a hand-rolled splitter to the real lexer state machine. Known gaps for v0.10: - Sub-interpreters and Py_NewInterpreter. The GIL-drop wiring is in; the contention path activates with sub-interpreters. - Full async iterator / awaitable surface (GET_AITER, GET_ANEXT, END_ASYNC_FOR). v0.9 ships error-returning stubs. - __match_args__ MRO walk. v0.9 walks type identity plus one level of Bases; full MRO arrives with the type-system port. - WITH_EXCEPT_START traceback argument (becomes real when the traceback object lands). - SEND_GEN specialisation. - Real frozen importlib code objects in imp/frozen_bootstrap.go. See changelog/v0.9.0.md for the full file-by-file breakdown.
v0.8.0 - the import drop marshal can round-trip .pyc files (PEP 552 timestamp and hash variants), the full TYPE_LONG/TYPE_CODE/TYPE_SET/TYPE_DICT/ TYPE_BINARY_COMPLEX type tags, and FLAG_REF back-references. The codecs package has a registry and built-in utf-8, ascii, and latin-1 codecs with alias normalization. The imp package implements the full import path: frozen module table, sys.modules cache, inittab, ExecCodeModule, source and .pyc loaders, and ImportModuleLevel with the sys.modules -> frozen -> built-in lookup chain. Relative imports resolve via resolveAbsName. IMPORT_NAME and IMPORT_FROM bytecodes in the eval loop now call into imp through the Executor interface, so `import foo` and `from foo import bar` work end-to-end for built-in and frozen modules.
PreviousNext