vm

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Wires objects.FunctionType.Call so a Python-defined function can be invoked through objects.Call. Lives in the vm package because the call needs to push a new frame and drive the eval loop, which the objects package can't reach without an import cycle.

CPython: Objects/funcobject.c function_call

Small helpers the dispatch arms call into. The action translator (1621/B6) emits some of these; the hand-written panel uses them directly. CPython has them as macros / inline helpers in Python/ceval_macros.h and Python/ceval.c.

RESUME / RETURN_GENERATOR / generator re-entry. CPython handles these in Python/ceval.c around the eval-loop entry. v0.6 keeps a minimal RESUME that polls the eval breaker and otherwise no-ops; the generator path lives behind the objects.Generator port (1687) and is wired in v0.7.

CPython: Python/ceval.c RESUME

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("vm: opcode not implemented in v0.6")

ErrNotImplemented is returned by dispatch arms that have not yet been generated. The eval loop surfaces it as a runtime error so tests can pin the surface without crashing.

Functions

func BreakerFor

func BreakerFor(ts *state.Thread) *gil.Breaker

BreakerFor is the public form of breakerFor for the same reason.

func Eval

func Eval(ts *state.Thread, f *frame.Frame) (objects.Object, error)

Eval runs f to completion under ts and returns the value the frame produced (RETURN_VALUE) or the error that escaped.

CPython: Python/ceval.c _PyEval_EvalFrameDefault

func EvalCode

func EvalCode(ts *state.Thread, co *objects.Code, globals, locals objects.Object) (objects.Object, error)

EvalCode is the convenience wrapper that builds a frame from a code object plus globals/locals and calls Eval.

CPython: Python/ceval.c PyEval_EvalCode

func PendingFor

func PendingFor(ts *state.Thread) *gil.Pending

PendingFor returns the pending-call queue for ts. Public so the signal bridge in user code (1651) can wire SIGINT into it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL