Documentation
¶
Overview ¶
Python function objects and the runtime calling convention. The compiler binds calls to known defs at compile time; everything else, a call through a variable or to a lambda, arrives here and binds against the stored signature with the same rules and the same TypeError catalog. The message helpers are exported so the compile-time binder in pkg/lower formats its inline raises through the exact same code and the two paths cannot drift.
Package objects implements the boxed Python object model for unagi. Every runtime value the emitted Go code touches is an Object here. CPython 3.14 is the oracle for results, reprs and error messages.
Index ¶
- Constants
- Variables
- func AsBigInt(o Object) (*big.Int, bool)
- func AsBool(o Object) (bool, bool)
- func AsBufferBytes(o Object) ([]byte, bool)
- func AsBytes(o Object) ([]byte, bool)
- func AsBytesLike(o Object) ([]byte, bool)
- func AsComplexParts(o Object) (re, im float64, ok bool)
- func AsExactFloat(o Object) (float64, bool)
- func AsFloat(o Object) (float64, bool)
- func AsFloatChecked(o Object) (float64, bool, error)
- func AsInt(o Object) (int64, bool)
- func AsIntValue(o Object) (int64, bool)
- func AsMutableBytes(o Object) ([]byte, bool)
- func AsStr(o Object) (string, bool)
- func Ascii(o Object) (string, error)
- func AsyncWithEnterT(t *Thread, gy Yielder, mgr Object) (aexitFn Object, entered Object, err error)
- func AsyncioSetEventLoop(t *Thread, arg Object) error
- func BuiltinCanonicalName(o Object) (string, bool)
- func BuiltinFuncName(o Object) (string, bool)
- func Callable(f Object) bool
- func ComplexAbs(re, im float64) (float64, error)
- func ComplexFromDunder(o Object) (re, im float64, ok bool, err error)
- func ComplexParts(o Object) (re, im float64, ok bool)
- func ComputeAbstractMethods(cls Object) error
- func ContainerIterName(o Object) string
- func CorrectlyRoundedHypot(xs ...float64) float64
- func CsvFieldLimit() int64
- func CsvSetFieldLimit(n int64) int64
- func DecodeLong(body []byte) *big.Int
- func DelAttr(o Object, name string) error
- func DelAttrT(t *Thread, o Object, name string) error
- func DelItem(o, key Object) error
- func DelSlice(o, lo, hi, step Object) error
- func DirNames(o Object) ([]string, bool, error)
- func EncodeLong(x *big.Int) []byte
- func EncodeStr(s, enc, errh string) ([]byte, error)
- func ExcClass(name string) (*classObject, bool)
- func ExcClassNames() []string
- func ExcMatchesClass(e *Exception, cls Object) bool
- func ExcMessageLine(e *Exception) string
- func FloatInf(sign int) float64
- func FloatNaN() float64
- func FunctionStr(f Object) string
- func GenericDelAttr(o Object, name string) error
- func HandledLen() int
- func HashlibAlgoNames() []string
- func HmacDigest(name string, key, msg []byte) ([]byte, error)
- func IntAsDoubleChecked(o Object) (float64, bool)
- func IsBigInt(o Object) bool
- func IsBuiltinTypeName(name string) bool
- func IsByteArrayInstance(o Object) bool
- func IsBytesInstance(o Object) bool
- func IsCContiguousBuffer(o Object) bool
- func IsChainMap(o Object) bool
- func IsCoreCodec(name string) bool
- func IsCoroutineObject(o Object) bool
- func IsDict(o Object) bool
- func IsDictBackedInstance(o Object) bool
- func IsExactInt(o Object) bool
- func IsExcClassValue(o Object) bool
- func IsExcGroupClass(name string) bool
- func IsExceptionClass(name string) bool
- func IsFutureObject(o Object) bool
- func IsList(o Object) bool
- func IsTypeValue(o Object) bool
- func Len(o Object) (int, error)
- func MarshalDumps(o Object) ([]byte, error)
- func MatchClass(subj, cls Object, nPos int, kwNames []string) ([]string, bool, error)
- func MatchMapping(o Object) bool
- func MatchSequence(o Object) bool
- func Matches(kind, class string) bool
- func MissingArgsMsg(fname, kind string, names []string) string
- func MutableBuffer(o Object) (buf []byte, commit func(), ok bool)
- func NewBarrier(parties int, action Object, hasTimeout bool, timeout time.Duration) *barrierObject
- func NewBoundedSemaphore(value int) *semaphoreObject
- func NewCondition(lock Object) (*condObject, error)
- func NewEvent() *eventObject
- func NewExecutor(maxWorkers int, namePrefix string) *executorObject
- func NewFrame(back *frameObject, globals *Module, file, name, qual string, firstline int, ...) *frameObject
- func NewFuture() *futureObject
- func NewLifoQueue(maxsize int) *queueObject
- func NewLock() *lockObject
- func NewPriorityQueue(maxsize int) *queueObject
- func NewQueue(maxsize int) *queueObject
- func NewRLock() *rlockObject
- func NewSemaphore(value int) *semaphoreObject
- func NewSimpleQueue() *simpleQueueObject
- func ParseComplex(s string) (float64, float64, bool)
- func Pbkdf2Hmac(name string, password, salt []byte, iterations, dklen int) ([]byte, error)
- func PickleDumps(o Object, proto int) ([]byte, error)
- func PopHandledExc()
- func PosOnlyKwMsg(fname string, names []string) string
- func PushHandledExc(err error)
- func PyHash(o Object) (int64, error)
- func QualifyBuiltin(fn Object, qual string)
- func RegisterPickleBuiltin(module, qualname string, obj Object)
- func RegisterPickleFunction(fn Object)
- func RegisterPickleModuleFunc(module, qualname string, o Object)
- func Repr(o Object) string
- func ReprE(o Object) (string, error)
- func ReversedInstance(o Object) (mode int, result Object, elems []Object, err error)
- func SetAdd(s, elt Object) error
- func SetBuiltinAttr(fn Object, name string, v Object) error
- func SetItem(o, key, val Object) error
- func SetSiteWrite(w func(string))
- func SetSlice(o, lo, hi, step, val Object) error
- func SetStderrWrite(w func(string))
- func SetZlibError(cls Object)
- func ShutdownExecutors()
- func StoreAttr(o Object, name string, val Object) error
- func StoreAttrT(t *Thread, o Object, name string, val Object) error
- func Str(o Object) string
- func StrE(o Object) (string, error)
- func StrFromRune(r rune) string
- func StrFromRunes(rs []rune) string
- func StrRunes(s string) []rune
- func SuggestKeyword(name string, candidates []string) string
- func SystemExitCode(e *Exception, writeErr func(string)) (int, bool)
- func TooManyPosMsg(fname string, minReq, nPosCap, given, kwonlyGiven int) string
- func Truth(o Object) bool
- func TruthOf(o Object) (bool, error)
- func TypeValueName(o Object) (string, bool)
- func UnexpectedKwMsg(fname, kw string, candidates []string) string
- func WithEnter(mgr Object) (exitFn Object, entered Object, err error)
- func WithEnterT(t *Thread, mgr Object) (exitFn Object, entered Object, err error)
- type ClassBuilder
- func (b *ClassBuilder) AnnotationLazy(name string, thunk func() (Object, error))
- func (b *ClassBuilder) Delete(name string) error
- func (b *ClassBuilder) Finish(staticAttrs []string) (Object, error)
- func (b *ClassBuilder) Load(name string) (Object, bool, error)
- func (b *ClassBuilder) Set(name string, v Object) error
- type CmpOp
- type Deopt
- type Exception
- func AsRaisable(o Object) (*Exception, bool)
- func CombineStar(rest *Exception, raised []*Exception) *Exception
- func CurrentHandled() *Exception
- func NewException(kind string, args []Object) *Exception
- func NewUnicodeDecodeError(encoding string, data []byte, start, end int, reason string) *Exception
- func NewUnicodeEncodeError(encoding, s string, start, end int, reason string) *Exception
- func Raise(kind, format string, a ...any) *Exception
- func SplitStar(e *Exception, kinds []string) (matched, rest *Exception)
- func SplitStarValues(e *Exception, classes []Object) (matched, rest *Exception)
- func WrapGroup(e *Exception) *Exception
- type Frame
- type Iterable
- type Iterator
- type LengthHinter
- type Module
- func (m *Module) Bind(name string, slot *Object)
- func (m *Module) File() string
- func (m *Module) FinishInit()
- func (m *Module) Get(name string) (Object, bool)
- func (m *Module) GlobalsDict() Object
- func (m *Module) Initializing() bool
- func (m *Module) Name() string
- func (m *Module) PublicNames() []string
- func (m *Module) SetGlobal(name string, v Object)
- func (m *Module) StartInit()
- func (*Module) TypeName() string
- type Object
- func Add(a, b Object) (Object, error)
- func AsCompleted(fs Object, hasTimeout bool, timeout time.Duration) (Object, error)
- func AsyncIterT(t *Thread, o Object) (Object, error)
- func AsyncNextT(t *Thread, gy Yielder, ait Object) (Object, bool, error)
- func AsyncioAllTasks(loop Object) (Object, error)
- func AsyncioAsCompleted(aws Object, timeout Object) (Object, error)
- func AsyncioBrokenBarrierErrorClass() Object
- func AsyncioCancelledErrorClass() Object
- func AsyncioCreateTask(coro Object, name string) (Object, error)
- func AsyncioCurrentTask(loop Object) (Object, error)
- func AsyncioEnsureFuture(arg Object) (Object, error)
- func AsyncioGather(args []Object, returnExceptions bool) (Object, error)
- func AsyncioGetEventLoop(t *Thread) (Object, error)
- func AsyncioIncompleteReadErrorClass() Object
- func AsyncioInvalidStateErrorClass() Object
- func AsyncioLimitOverrunErrorClass() Object
- func AsyncioNewBarrier(parties int) (Object, error)
- func AsyncioNewCondition(lock Object) (Object, error)
- func AsyncioNewEvent() Object
- func AsyncioNewEventLoop() Object
- func AsyncioNewFuture() (Object, error)
- func AsyncioNewLifoQueue(maxsize int) Object
- func AsyncioNewLock() Object
- func AsyncioNewPriorityQueue(maxsize int) Object
- func AsyncioNewQueue(maxsize int) Object
- func AsyncioNewRunner(debug Object, loopFactory Object) Object
- func AsyncioNewSemaphore(value int, bounded bool) (Object, error)
- func AsyncioNewStreamReader(limit int) (Object, error)
- func AsyncioNewTaskGroup() Object
- func AsyncioNewTimeout(delay Object) (Object, error)
- func AsyncioNewTimeoutAt(when Object) (Object, error)
- func AsyncioOpenConnection(host string, port int) Object
- func AsyncioQueueEmptyClass() Object
- func AsyncioQueueFullClass() Object
- func AsyncioQueueShutDownClass() Object
- func AsyncioRun(main Object) (Object, error)
- func AsyncioRunT(t *Thread, main Object) (Object, error)
- func AsyncioRunViaRunner(t *Thread, main Object, debug Object, loopFactory Object) (Object, error)
- func AsyncioRunningLoop() Object
- func AsyncioShield(arg Object) (Object, error)
- func AsyncioSleep(delay float64, result Object) Object
- func AsyncioStartServer(cb Object, host string, port int) Object
- func AsyncioToThread(fn Object, args []Object, kwNames []string, kwVals []Object) (Object, error)
- func AsyncioWait(fs Object, timeout Object, returnWhen Object) Object
- func AsyncioWaitFor(aw Object, timeout Object) Object
- func Await(o Object) (Object, error)
- func AwaitThrough(gy Yielder, awaitable Object) (Object, error)
- func BackslashReplaceErrors(args []Object) (Object, error)
- func BitAnd(a, b Object) (Object, error)
- func BitOr(a, b Object) (Object, error)
- func BitXor(a, b Object) (Object, error)
- func BrokenBarrierErrorClass() Object
- func BrokenExecutorClass() Object
- func BrokenThreadPoolClass() Object
- func BuiltinIntValue(o Object) (Object, bool)
- func BuiltinValue(o Object) (Object, bool)
- func ByteArrayOf(args []Object) (Object, error)
- func ByteArrayOfKw(pos []Object, kwNames []string, kwVals []Object) (Object, error)
- func BytesOf(args []Object) (Object, error)
- func BytesOfKw(pos []Object, kwNames []string, kwVals []Object) (Object, error)
- func Call(f Object, args []Object) (Object, error)
- func CallEx(f Object, pos []Object, kw Object) (Object, error)
- func CallExT(t *Thread, f Object, pos []Object, kw Object) (Object, error)
- func CallKw(f Object, pos []Object, kwNames []string, kwVals []Object) (Object, error)
- func CallKwT(t *Thread, f Object, pos []Object, kwNames []string, kwVals []Object) (Object, error)
- func CallMethod(o Object, name string, args []Object) (Object, error)
- func CallMethodEx(recv Object, name string, pos []Object, kw Object) (Object, error)
- func CallMethodExT(t *Thread, recv Object, name string, pos []Object, kw Object) (Object, error)
- func CallMethodKw(o Object, name string, pos []Object, kwNames []string, kwVals []Object) (Object, error)
- func CallMethodKwT(t *Thread, o Object, name string, pos []Object, kwNames []string, ...) (Object, error)
- func CallMethodStar(recv Object, name string, star Object) (Object, error)
- func CallMethodStarEx(recv Object, name string, star Object, kw Object) (Object, error)
- func CallMethodStarExT(t *Thread, recv Object, name string, star Object, kw Object) (Object, error)
- func CallMethodStarT(t *Thread, recv Object, name string, star Object) (Object, error)
- func CallMethodT(t *Thread, o Object, name string, args []Object) (Object, error)
- func CallStarEx(f Object, star Object, kw Object) (Object, error)
- func CallStarExT(t *Thread, f Object, star Object, kw Object) (Object, error)
- func CallT(t *Thread, f Object, args []Object) (Object, error)
- func CancelledErrorClass() Object
- func ChainMapFromKeys(iterable, value Object) (Object, error)
- func ClassOf(o Object) (Object, bool)
- func Compare(op CmpOp, a, b Object) (Object, error)
- func CompareDigest(a, b Object) (Object, error)
- func ComplexNew(real, imag Object) (Object, error)
- func Contains(container, item Object) (Object, error)
- func ContextTokenClass() Object
- func CopyThreadContext(t *Thread) Object
- func CurrentThreadObject(t *Thread) Object
- func DecodeBytes(v []byte, encoding, errors string) (Object, error)
- func DecodeBytesStateful(v []byte, encoding, errors string, final bool) (Object, int, error)
- func DivmodDunder(a, b Object) (Object, bool, error)
- func ExcClass2(name string) Object
- func ExcClassValue(name string) (Object, bool)
- func ExcNoKeywords(className string, pos []Object, kw Object) ([]Object, error)
- func ExcType(kind string) Object
- func ExcTypeOf(e *Exception) Object
- func ExtendStar(pos []Object, it Object) ([]Object, error)
- func FlattenMatchers(classes []Object) []Object
- func FloatFromDunder(o Object) (Object, bool, error)
- func FloorDiv(a, b Object) (Object, error)
- func Format(o Object, spec string) (Object, error)
- func FuturesErrorClass() Object
- func GetItem(o, key Object) (Object, error)
- func GetSlice(o, lo, hi, step Object) (Object, error)
- func IDOf(o Object) Object
- func IgnoreErrors(args []Object) (Object, error)
- func InPlace(sym string, a, b Object) (Object, error)
- func IndexOf(o Object) (Object, bool, error)
- func InstanceDict(o Object) (Object, error)
- func InstanceDunder(o Object, name string, args ...Object) (Object, bool, error)
- func InstanceOverride(o Object, name string, args ...Object) (Object, bool, error)
- func Instantiate(c *classObject, pos []Object, kwNames []string, kwVals []Object) (Object, error)
- func InstantiateT(t *Thread, c *classObject, pos []Object, kwNames []string, kwVals []Object) (Object, error)
- func IntFromDunder(o Object) (Object, bool, error)
- func InvalidStateErrorClass() Object
- func Invert(o Object) (Object, error)
- func Is(a, b Object) Object
- func IsInstance(obj, cls Object) (Object, error)
- func IsSubclass(sub, cls Object) (Object, error)
- func IterBuiltinResult(o Object) (res Object, ok bool, err error)
- func IterToSlice(o Object) ([]Object, error)
- func KwMerge(f, kw Object, m Object) (Object, error)
- func KwMergeFor(funcstr string, kw Object, m Object) (Object, error)
- func KwMergeM(recv Object, name string, kw Object, m Object) (Object, error)
- func KwSet(f, kw Object, name string, v Object) (Object, error)
- func KwSetFor(funcstr string, kw Object, name string, v Object) (Object, error)
- func KwSetM(recv Object, name string, kw Object, key string, v Object) (Object, error)
- func LShift(a, b Object) (Object, error)
- func LoadAttr(o Object, name string) (Object, error)
- func LoadAttrT(t *Thread, o Object, name string) (Object, error)
- func MainThreadObject() Object
- func MarshalLoads(data []byte) (Object, error)
- func MatMul(a, b Object) (Object, error)
- func MatchClassAttr(subj Object, name string) (Object, bool, error)
- func MatchKeys(o Object, keys []Object) ([]Object, bool, error)
- func MatchRest(o Object, keys []Object) (Object, error)
- func MatchStar(o Object, before, after int) (Object, error)
- func MemoryViewOf(args []Object) (Object, error)
- func Mod(a, b Object) (Object, error)
- func Mul(a, b Object) (Object, error)
- func NameReplaceErrors(args []Object) (Object, error)
- func Neg(o Object) (Object, error)
- func NewArray(codeObj, init Object) (Object, error)
- func NewAsyncGenerator(qual string, body func(Yielder) (Object, error)) Object
- func NewBZ2Compressor() Object
- func NewBZ2Decompressor() Object
- func NewBool(b bool) Object
- func NewByteArray(b []byte) Object
- func NewBytes(b []byte) Object
- func NewBytesIO(initial []byte) Object
- func NewCachedProperty(fn Object) Object
- func NewChainMap(maps []Object) (Object, error)
- func NewClass(name, qual string, bases []Object, names []string, vals []Object, ...) (Object, error)
- func NewClassMethod(fn Object) Object
- func NewCmpKey(cmp Object) Object
- func NewComplex(re, im float64) Object
- func NewContextVar(name string, hasDefault bool, def Object) Object
- func NewCoroutine(qual string, body func(Yielder) (Object, error)) Object
- func NewCounter(keys, vals []Object) (Object, error)
- func NewCsvDialect(base Object, kwNames []string, kwVals []Object) (Object, error)
- func NewCsvReader(iterable Object, dialect Object, errClass Object) (Object, error)
- func NewCsvWriter(fileobj Object, dialect Object, errClass Object) (Object, error)
- func NewDefaultDict(factory Object, keys, vals []Object) (Object, error)
- func NewDeque(elts []Object, maxlen int) Object
- func NewDict(keys, vals []Object) (Object, error)
- func NewDictUnpack(keys, vals []Object) (Object, error)
- func NewEmptyContext() Object
- func NewExcGroup(kind string, args []Object) (Object, error)
- func NewExceptionKw(className string, pos []Object, kw Object) (Object, error)
- func NewFloat(v float64) Object
- func NewFrozenset(elts []Object) (Object, error)
- func NewFunc(name string, arity int, fn func(args []Object) (Object, error)) Object
- func NewFuncKw(name string, ...) Object
- func NewFuncKwT(name string, ...) Object
- func NewFuncT(name string, arity int, fnT func(t *Thread, args []Object) (Object, error)) Object
- func NewFunction(qual string, params []Param, defaults []Object, ...) Object
- func NewFunctionT(qual string, params []Param, defaults []Object, ...) Object
- func NewGenerator(qual string, body func(Yielder) (Object, error)) Object
- func NewGeneratorAt(qual string, seed int, body func(Yielder, int) (Object, error)) Object
- func NewGenericAlias(origin, item Object) Object
- func NewHashByName(name string, data []byte) (Object, error)
- func NewHelper(name, reprText, callText string) Object
- func NewHmac(name string, key, msg []byte) (Object, error)
- func NewInt(v int64) Object
- func NewIntFromBig(b *big.Int) Object
- func NewIntText(s string) Object
- func NewInterpolation(value Object, expression string, conversion, formatSpec Object) Object
- func NewLRUCache(fn Object, maxsize int, typed bool) Object
- func NewList(elts []Object) Object
- func NewLocal() Object
- func NewMappingProxy(m Object) (Object, error)
- func NewMemoryView(o Object) (Object, error)
- func NewMethod(name string, arity int, fn func(args []Object) (Object, error)) Object
- func NewMethodKw(name string, ...) Object
- func NewNamedTupleType(name string, fields []string, defaults []Object) (Object, error)
- func NewOrderedDict(keys, vals []Object) (Object, error)
- func NewParamSpecArgsConstructor() Object
- func NewParamSpecConstructor() Object
- func NewParamSpecKwargsConstructor() Object
- func NewPartial(fn Object, args []Object, kwNames []string, kwVals []Object) (Object, error)
- func NewPattern(pattern Object, flags uint32, code []uint32, groups int, ...) Object
- func NewPlaceholder() Object
- func NewPrinter(name, reprText, callText string) Object
- func NewProperty(fget, fset, fdel Object) Object
- func NewQuitter(name string) Object
- func NewRange(start, stop, step int64) Object
- func NewRangeBig(start, stop, step *big.Int) Object
- func NewReTemplate(items []Object) Object
- func NewSet(elts []Object) (Object, error)
- func NewSimpleNamespace(names []string, vals []Object) Object
- func NewSingleDispatch(fn Object) Object
- func NewSlice(start, stop, step Object) Object
- func NewStaticMethod(fn Object) Object
- func NewStr(s string) Object
- func NewStringIO(initial string) Object
- func NewSuper(start, obj Object) (Object, error)
- func NewSuperUnbound(start Object) (Object, error)
- func NewTemplate(strings, interps []Object) Object
- func NewThreadObject(target Object, args []Object, kwNames []string, kwVals []Object, name string, ...) Object
- func NewTuple(elts []Object) Object
- func NewTupleGetter(index int, doc Object) Object
- func NewType3(nameArg, basesArg, nsArg Object) (Object, error)
- func NewType3Kw(nameArg, basesArg, nsArg Object, kwNames []string, kwVals []Object) (Object, error)
- func NewTypeAlias(name string, compute Object) Object
- func NewTypeAliasTypeConstructor() Object
- func NewTypeVarConstructor() Object
- func NewTypeVarTupleConstructor() Object
- func NewWeakref(referent, callback Object) (Object, error)
- func NewZlibCompress(level, wbits int) (Object, error)
- func NewZlibDecompress(wbits int) Object
- func NewZlibDecompressor(wbits int) Object
- func NextValue(args []Object) (Object, error)
- func NoDefaultSingleton() Object
- func Not(o Object) Object
- func NotOf(o Object) (Object, error)
- func ObjectType() Object
- func PickleErrorClass() Object
- func PickleLoads(data []byte) (Object, error)
- func PicklingErrorClass() Object
- func Pos(o Object) (Object, error)
- func Pow(a, b Object) (Object, error)
- func PowDunder(base, exp, mod Object) (Object, bool, error)
- func QueueEmptyClass() Object
- func QueueFullClass() Object
- func QueueShutDownClass() Object
- func RShift(a, b Object) (Object, error)
- func ReplaceErrors(args []Object) (Object, error)
- func RoundFloat(f float64, nd int64) (Object, error)
- func RoundFloatToInt(f float64) (Object, error)
- func RunCoroutineThreadsafe(coro Object, loopArg Object) (Object, error)
- func SeqItem(o Object, i int) (Object, error)
- func SliceOf(args []Object) (Object, error)
- func StarArgsFor(funcstr string, star Object) ([]Object, error)
- func StrDecode(o, encoding, errors Object) (Object, error)
- func Sub(a, b Object) (Object, error)
- func SurrogateEscapeErrors(args []Object) (Object, error)
- func SurrogatePassErrors(args []Object) (Object, error)
- func TotalOrdering(cls Object) (Object, error)
- func TrueDiv(a, b Object) (Object, error)
- func TypeSingleton(name string) Object
- func UnionForm() Object
- func Unpack(o Object, n int) ([]Object, error)
- func UnpackEx(o Object, before, after int) ([]Object, error)
- func UnpicklingErrorClass() Object
- func UnwrapPartial(o Object) Object
- func UpdateWrapper(wrapper, wrapped, assigned, updated Object) (Object, error)
- func UserMetaOf(o Object) (Object, bool)
- func Wait(fs Object, hasTimeout bool, timeout time.Duration, returnWhen Object) (Object, error)
- func WithFuncAnnotationsLazy(fn Object, names []string, thunks []func() (Object, error)) Object
- func WithFuncDoc(fn Object, doc string) Object
- func WithFuncFirstLine(fn Object, line int) Object
- func WithFuncModule(fn Object, name string) Object
- func WithFuncModuleObj(fn Object, name Object) Object
- func XMLCharRefReplaceErrors(args []Object) (Object, error)
- type Param
- type ParamKind
- type StructSeqType
- type Thread
- func (t *Thread) Daemon() bool
- func (t *Thread) Done() chan struct{}
- func (t *Thread) EnterRecursive(limit int) error
- func (t *Thread) FrameAtDepth(depth int) (Object, error)
- func (t *Thread) Ident() int64
- func (t *Thread) IsMain() bool
- func (t *Thread) LeaveRecursive()
- func (t *Thread) Name() string
- func (t *Thread) PopFrame()
- func (t *Thread) PushFrame(f *frameObject)
- func (t *Thread) SetDaemon(d bool)
- func (t *Thread) SetLine(n int)
- func (t *Thread) SetName(name string)
- func (t *Thread) SetWrapper(w Object)
- func (t *Thread) Wrapper() Object
- type Yielder
Constants ¶
const ( // ReversedNotInstance means o is not a user instance; the caller reverses // its own builtin sequences. ReversedNotInstance = iota // ReversedResult means __reversed__ handled it; the caller returns Result // verbatim (CPython does not require __reversed__ to return an iterator). ReversedResult // ReversedElems means the __len__ + __getitem__ fallback produced Elems, // already in reverse order, for the caller to wrap as a reversed iterator. ReversedElems )
Reversed mode results for ReversedInstance.
const ( TypeError = "TypeError" ValueError = "ValueError" ZeroDivisionError = "ZeroDivisionError" IndexError = "IndexError" KeyError = "KeyError" NameError = "NameError" UnboundLocalError = "UnboundLocalError" AttributeError = "AttributeError" RuntimeError = "RuntimeError" OverflowError = "OverflowError" RecursionError = "RecursionError" BufferError = "BufferError" ImportError = "ImportError" ModuleNotFoundError = "ModuleNotFoundError" )
Exception kind names. These are the Python exception class names and they show up verbatim in Error() output and tracebacks.
const ( PickleDefaultProtocol = 5 PickleHighestProtocol = 5 )
Pickle protocol bounds. CPython 3.14 defaults to protocol 5 and tops out there; dumps() with no protocol uses PickleDefaultProtocol.
const ( SreFlagIgnorecase uint32 = 2 SreFlagLocale uint32 = 4 SreFlagMultiline uint32 = 8 SreFlagDotall uint32 = 16 SreFlagUnicode uint32 = 32 SreFlagVerbose uint32 = 64 SreFlagDebug uint32 = 128 SreFlagAscii uint32 = 256 )
Pattern compilation flag bits. The values are the SRE_FLAG_* bits re._constants defines, the same bits the flags argument to _sre.compile carries.
const ( SreMagic = 20230612 SreCodeSize = 4 SreMaxRepeat = 0xFFFFFFFF SreMaxGroups = 1073741823 )
SRE engine limits and identifiers exposed as _sre module attributes. MAGIC stamps the bytecode version re._compiler emits, CODESIZE is the byte width of one bytecode word in CPython's UCS4 packing, MAXREPEAT is the unbounded-count sentinel, and MAXGROUPS caps the group count.
const MarshalVersion = 5
MarshalVersion is the format version marshal.version reports for CPython 3.14.
Variables ¶
var ( // CodecEncodeHook encodes a str under a codec the core switch does not // handle, resolving it through the registry's search functions. It returns // the encoded bytes, or a LookupError if no registered codec claims enc. CodecEncodeHook func(s, enc, errh string) ([]byte, error) // CodecDecodeHook decodes bytes under a codec the core switch does not // handle, resolving it through the registry's search functions. It returns // the decoded str, or a LookupError if no registered codec claims enc. CodecDecodeHook func(v []byte, enc, errh string) (Object, error) // CodecTextCheckHook reports whether a codec may be used where a text codec // is required, the guard CPython's PyUnicode_AsEncodedString and // PyUnicode_Decode apply on str.encode, bytes.decode and the str/bytes // constructors. It returns the LookupError to raise when the codec's // CodecInfo marks _is_text_encoding false (a bytes-to-bytes or str-to-str // transform codec such as base64_codec or rot_13), or nil when the codec is // a text codec or unknown. direction is "encode" or "decode" and picks the // codecs.encode()/codecs.decode() hint in the message. CodecTextCheckHook func(enc, direction string) error )
The utf-8, ascii and latin-1 codec families are built into this package so str.encode, bytes.decode and the two-argument bytes/str constructors resolve them without importing anything. Every other codec — utf-16, hex_codec, rot_13, utf-8-sig and the rest of the encodings package — is a pure-Python module the runtime resolves through the codec registry, a layer above this one. These hooks let the built-in codec paths fall through to that registry for a name they do not handle, so "hi".encode("utf-8-sig") reaches the same codec codecs.encode("hi", "utf-8-sig") does. The runtime's _codecs module installs them at import; while they are nil an unknown codec raises the ordinary LookupError, the behavior before the registry is wired.
var ( CasedHook func(rune) bool CaseIgnorableHook func(rune) bool )
CasedHook and CaseIgnorableHook report the Cased and Case_Ignorable properties str.lower's Final_Sigma walk consults. The unicodedata shim fills them at init from sets recovered from the pinned str.lower; when unset the walk falls back to Go's simple properties.
var ( UppercaseHook func(rune) bool LowercaseHook func(rune) bool )
UppercaseHook and LowercaseHook report the Uppercase and Lowercase properties. str.swapcase branches on them (an uppercase character is lowercased and a lowercase one uppercased) and str.isupper / str.islower classify with them. The unicodedata shim fills them at init from the pinned sets; when unset those methods fall back to Go's simple properties.
var ( CategoryHook func(rune) string DigitHook func(rune) bool NumericHook func(rune) bool )
CategoryHook returns the pinned general category (the two-letter code) of a code point, DigitHook and NumericHook report whether it carries a digit or a numeric value. The unicodedata shim fills them at init from the pinned 3.14.6 UCD so str.isalpha, str.isalnum, str.isdecimal, str.isdigit, str.isnumeric and str.isprintable classify the newer blocks the way CPython does; when unset the predicates fall back to Go's simpler unicode tables.
var ( IDStartHook func(rune) bool IDContinueHook func(rune) bool )
IDStartHook and IDContinueHook report the XID_Start (with the underscore) and XID_Continue properties str.isidentifier classifies with. The unicodedata shim fills them at init from the pinned sets; when unset str.isidentifier falls back to Go's simpler identifier tables.
var ( WrapperAssignments = []string{"__module__", "__name__", "__qualname__", "__annotations__", "__doc__"} WrapperUpdates = []string{"__dict__"} )
WrapperAssignments and WrapperUpdates are the functools defaults: the attributes update_wrapper copies straight across and the dict attributes it merges. They match CPython's WRAPPER_ASSIGNMENTS and WRAPPER_UPDATES.
var BuiltinFuncSelf func(fn Object) (Object, bool)
BuiltinFuncSelf returns the module a plain builtin function reports through __self__, so len.__self__ is the builtins module the way CPython binds a builtin_function_or_method to the module it lives in. The runtime installs it because the builtins namespace and the module object both live there; it answers ok only for a genuine builtins-namespace function, identified by object identity, so a native-module function such as math.sqrt (whose __self__ is its own module) and a type constructor both fall through. A nil resolver leaves the read an AttributeError, the prior behavior.
var BuiltinGlobalLookup func(module, qualname string) (Object, bool)
BuiltinGlobalLookup resolves a (module, qualname) an unregistered builtin was saved under back to the live object, the load-side twin of BuiltinGlobalNamer, so a global reference round-trips to the same singleton the pickler named.
var BuiltinGlobalNamer func(o Object) (module, qualname string, isType, ok bool)
BuiltinGlobalNamer reports the (module, qualname) an unregistered builtin pickles under, for the builtins-namespace types and functions the runtime exposes (int, len, list, dict, ...). CPython saves each as a builtins.<name> global read off its __module__/__qualname__, but a transpiled builtin carries no such metadata, so the runtime supplies the reverse name lookup here. isType reports whether the object is a builtin type (int, list, map) rather than a builtin function (len, abs): the two carry distinct 'builtins' module strings, so the pickler groups their module-name memo separately. It reports ok false for an object that is not a picklable builtins-namespace value.
var BuiltinTypeResolver func(name string) (Object, bool)
BuiltinTypeResolver returns the type object registered under a builtin type name, so this package can name int or bool as an element of another builtin type's linearization. The runtime installs it in its init because that is where the builtin constructors live; a nil resolver just means only the object tail resolves, which is enough for the common (T, object) chain.
var CaseFoldHook func(rune) []rune
CaseFoldHook returns the full Unicode case fold of a code point, or nil when the point folds to itself. It is a hook the unicodedata shim fills at init from the pinned CaseFolding.txt so this package need not carry the UCD table; when unset (unicodedata not linked) strCasefold falls back to the simple lowercase.
var ClassOfResolver func(o Object) Object
ClassOfResolver returns the type object a value reports through __class__, the same object type(x) yields. The runtime installs it in its init from TypeOf, where the builtin constructors live; LoadAttr uses it to answer __class__ for the scalar and container builtins, which have no dedicated case of their own, so _py_abc's __instancecheck__ read `instance.__class__` succeeds on 42 or a bare list. A nil resolver leaves those reads an AttributeError, the prior behavior.
var CompileReTemplate func(pattern, repl Object) (Object, error)
CompileReTemplate compiles a string replacement into a template by running the re package's own _compile_template, so the template mini-language (\1, \g<n>, \g<name>, the octal escapes, and the standard character escapes) parses the way CPython spells it. The runtime installs it once the re machinery is reachable; it is nil until then, which no substitution can hit because a Pattern only exists after re has imported.
var DeoptSignal error = &Deopt{}
DeoptSignal is the bare deopt sentinel a static generator's Next returns when a guard inside the machine fails. Unlike a function's Deopt it carries no Value: a generator has no from-top boxed twin that produces one result, so there is nothing to hand back through the machine itself. Instead the consumer driving the generator sees this on Next's error channel, recognizes it by *Deopt type, and re-runs its own drive loop boxed from the top, where a boxed generator yields the whole correct sequence. The consumer builds its own Deopt{Value} for its result; this shared instance is only the signal that a static generator gave up mid-sequence, so its nil Value is never read.
var InvertBoolWarnHook func() error
Invert implements unary ~. Probed: ~True is int -2, ~ on bool never stays bool. InvertBoolWarnHook, when set, is called by Invert on an exact bool operand to raise CPython 3.14's DeprecationWarning that `~` on a bool returns the bitwise inversion of the underlying int and is removed in 3.16. runtime wires it to warnings.warn; it stays nil in objects-only builds and tests, where the deprecation is simply not surfaced. A non-nil error (the filter turned the warning into an exception) aborts the operation the way CPython does.
var LowerFullHook func(rune) []rune
LowerFullHook returns the full Unicode lowercase of a code point, or nil when the point lowercases to itself. It is a hook the unicodedata shim fills at init from the pinned SpecialCasing/UnicodeData lowercase mappings so this package need not carry the UCD table; when unset (unicodedata not linked) strLower falls back to Go's simple 1:1 lowercase. The Greek capital sigma is absent from the table on purpose; its final form is chosen by the Final_Sigma walk below.
var NameReplaceNameLookup func(rune) (string, bool)
NameReplaceNameLookup resolves a code point to its Unicode character name for the namereplace handler, returning false when the point has no name. It is a hook the unicodedata shim fills at init so this package need not depend on the runtime name tables; when unset (unicodedata not linked) namereplace falls back to the backslash escape for every character, matching what CPython emits for a code point with no name.
var OSErrorSubclass func(errno int64) (string, bool)
OSErrorSubclass maps an errno to the OSError subclass CPython selects for it, or reports no mapping. It is a hook so the errno constants stay in a platform-tagged runtime file (they come from package syscall) and this package stays platform-independent. It is nil until a runtime init wires it; on a host with no mapping wired, base OSError simply keeps its class, which is safe.
var SpawnFunc func(t *Thread, target func())
SpawnFunc is the runtime's goroutine-and-registry spawn, injected at init so a threadObject here can start a thread without importing pkg/runtime, which sits above pkg/objects. runtime's registry init sets it to runtime.SpawnThread. It is written once before any thread can run and only read afterward, so it needs no synchronization.
var ThreadExcHook func(err error)
ThreadExcHook receives an error a thread's target returns so the runtime can report it the way threading.excepthook does, without pkg/objects reaching up for the traceback machinery. It is nil until a later slice wires the hook; a nil hook drops the error, which is safe for targets that do not raise.
var TitleFullHook func(rune) []rune
TitleFullHook returns the full Unicode titlecase of a code point, or nil when the point titlecases to itself. It is a hook the unicodedata shim fills at init from the pinned SpecialCasing/UnicodeData titlecase mappings so this package need not carry the UCD table; when unset (unicodedata not linked) strTitle and strCapitalize fall back to Go's simple 1:1 titlecase.
var UpperFullHook func(rune) []rune
UpperFullHook returns the full Unicode uppercase of a code point, or nil when the point uppercases to itself. It is a hook the unicodedata shim fills at init from the pinned SpecialCasing/UnicodeData uppercase mappings so this package need not carry the UCD table; when unset (unicodedata not linked) strUpper falls back to Go's simple 1:1 uppercase.
Functions ¶
func AsBigInt ¶
AsBigInt extracts any int-ish value (int or bool) as a big.Int. The result must be treated as read-only: for spilled ints it aliases the object's own storage.
func AsBool ¶
AsBool extracts the Go boolean from a bool object. It is exact: an int or a truthy value is not a bool and returns false, so a caller that needs the bool representation, not mere truthiness, can tell the two apart.
func AsBufferBytes ¶
AsBufferBytes returns the bytes behind any bytes-like object, a bytes, bytearray, memoryview or array, for callers outside the package that consume the buffer protocol such as the _hashlib constructors.
func AsBytesLike ¶
AsBytesLike is the exported accessor over a bytes or bytearray value, for callers outside this package like the io.BytesIO constructor.
func AsComplexParts ¶
AsComplexParts coerces a value to complex parts the way struct's 'F' and 'D' codes take their argument: a complex keeps its parts and an int, bool or float becomes a real value with a zero imaginary part. Any other type reports ok=false so the caller raises "required argument is not a complex".
func AsExactFloat ¶
AsExactFloat reads the double from a value of exactly the built-in float type, excluding int, bool, and float subclasses, matching CPython's PyFloat_CheckExact followed by PyFloat_AS_DOUBLE.
func AsFloat ¶
AsFloat extracts a numeric value from a float, int or bool object. A spilled int converts through big.Float and comes back as an infinity when it is out of range; arithmetic paths that must raise instead use asFloatChecked.
func AsFloatChecked ¶
AsFloatChecked is the overflow-checked counterpart to AsFloat: it rejects an int too large for a float64 with CPython's OverflowError instead of returning an infinity, for callers such as the math functions that coerce through CPython's PyFloat_AsDouble rather than a silent widening.
func AsInt ¶
AsInt extracts an int64-sized integer value from an int or bool object. Spilled big ints return false; callers that must handle any magnitude go through AsBigInt.
func AsIntValue ¶
AsIntValue reads an int64 from an int or bool, or from an int subclass instance by unwrapping its payload. re._constants spells its opcodes as _NamedIntConstant, an int subclass, and _compiler emits those as the bytecode words _sre.compile decodes, so the decoder reaches through the subclass the way AsInt alone cannot.
func AsMutableBytes ¶
AsMutableBytes returns the live backing slice of a bytearray, for a caller that writes into it in place like struct.pack_into. Only a bytearray is writable; a read-only bytes value returns false. The slice length is fixed, so a caller must bounds-check before writing.
func Ascii ¶
Ascii is ascii(): the repr with every non-ASCII rune replaced by its backslash escape. CPython's ascii escapes only appear where the repr has a non-ASCII rune (a string's contents, an identifier), and any backslash the repr already produced for a control character is plain ASCII, so escaping each rune >= 0x80 in the repr string reproduces ascii() exactly: \xHH up to 0xff, \uHHHH up to 0xffff, else \UHHHHHHHH, lowercase hex like repr.
func AsyncWithEnterT ¶
AsyncWithEnterT runs the entry half of the asynchronous context-manager protocol. It looks up __aexit__ then __aenter__ on the manager's type, both before either runs, awaits __aenter__ through the enclosing coroutine's yielder, and hands back the bound __aexit__ to await on the way out together with the awaited result of __aenter__. A type missing either method raises the protocol TypeError probed on 3.14, which names __aexit__ first and, when the type also supports the plain with protocol, points the writer at 'with'.
The ambient thread threads into both halves, so a native async manager would see the goroutine that runs the with; the returned __aexit__ closure captures the same thread. The yielder drives the awaits, so a real coroutine __aenter__ suspends the frame and a bare one runs to completion, exactly as await does.
func AsyncioSetEventLoop ¶
AsyncioSetEventLoop is asyncio.set_event_loop(loop). It stores loop as the thread's current loop, the one get_event_loop hands back when none is running. A None argument clears the slot; anything that is not a loop is the TypeError CPython's policy raises.
func BuiltinCanonicalName ¶
BuiltinCanonicalName returns a builtin type's own __qualname__ when it carries one, so the namer can prefer it over an alias that shares the same singleton. IOError and EnvironmentError both alias OSError in the builtins namespace, and a reverse identity scan of the builtins table would otherwise return whichever alias it happened to hit first; CPython always writes the canonical OSError, the type's __qualname__, so preferring that name keeps the pickle deterministic and byte-identical. Only class objects report a name; a builtin function returns false and the namer keeps its sole table entry.
func BuiltinFuncName ¶
BuiltinFuncName returns the name of a builtin function object, the funcObject the runtime registers for names like int, len, and type. ok is false for every other object, including user functions.
func Callable ¶
Callable reports whether Call would dispatch f rather than raise the "not callable" TypeError: the function, bound-method, class and builtin objects are always callable, and an instance is callable exactly when its class defines __call__. It mirrors the Call type switch above so callable() never disagrees with an actual call.
func ComplexAbs ¶
ComplexAbs is the magnitude hypot(re, im), raising OverflowError when a finite pair produces an infinite result, the way CPython's _Py_c_abs signals ERANGE. An infinite part yields inf without error and a nan part yields nan, so abs() and complex.__abs__ agree on the whole domain.
CPython's _Py_c_abs calls the platform C hypot, which is correctly rounded on glibc and macOS, so the result is the nearest double to the true magnitude. Go's math.Hypot is not correctly rounded and lands a unit in the last place off on around a quarter of small integer pairs (hypot(2, 3) is the first), so the finite case here rounds the true magnitude once through extended precision to match CPython byte for byte. The non-finite cases follow C99's hypot rules (an infinite part wins over a nan, otherwise a nan yields nan), which Go's math.Hypot already implements, so they defer to it.
func ComplexFromDunder ¶
ComplexFromDunder exposes complexFromDunder for callers such as cmath, which coerce an argument through CPython's PyComplex_AsCComplex the same way.
func ComplexParts ¶
ComplexParts reports the parts of an actual complex, and ok=false for every other type; abs() uses it to spot a complex without coercing int or float.
func ComputeAbstractMethods ¶
ComputeAbstractMethods installs cls.__abstractmethods__, the frozenset of names that still resolve to an abstract method on cls. It is the _abc_init step abc's C-backed ABCMeta.__new__ runs after type.__new__ builds the class: gather the abstract names from cls's own namespace plus every base's __abstractmethods__, then keep only those whose MRO resolution is still abstract. Unlike setNativeAbstractMethods it always installs the attribute, empty frozenset included, matching CPython where every ABC carries it.
func ContainerIterName ¶
ContainerIterName exposes containerIterName to package runtime, so the iter() builtin names its handle the same iterator type a container's own __iter__ reports. For a plain iterable that is not one of the builtin containers it returns "iterator", the generic name iter() has always used.
func CorrectlyRoundedHypot ¶
CorrectlyRoundedHypot returns sqrt(sum of the squares of xs) correctly rounded to double, for finite coordinates. Each square is formed in a big.Float wide enough to hold it exactly (a double squared needs 106 bits) and the running sum carries far more precision than the final double needs, then the square root is taken and rounded once to double, so the result is the nearest double to the exact magnitude, the value the platform C hypot and CPython's math.hypot both yield. big.Float carries its own exponent, so squares that overflow or underflow double (1e200 or 1e-200) still contribute, and only a true magnitude past the double range rounds to inf. Callers screen out infinite and nan coordinates first, so this only sees finite input.
func CsvSetFieldLimit ¶
CsvSetFieldLimit sets the field-size limit and returns the previous value, the field_size_limit(newlimit) contract.
func DecodeLong ¶
DecodeLong is pickle.decode_long: the integer a two's-complement little-endian byte string denotes, zero for empty.
func DelAttr ¶
DelAttr implements del o.name. On an instance a data descriptor with __delete__ intercepts the delete, a property runs its deleter or raises the no-deleter error, and otherwise the instance-dict entry is removed, missing name being the same AttributeError a read gives. On a class the class-dict entry is removed, missing name spelling the type-object wording.
func DelAttrT ¶
DelAttrT implements del o.name for the thread t, routing a threading.local into t's private store and delegating every other receiver to DelAttr.
func DirNames ¶
DirNames implements dir(o) for a user instance. A class that defines __dir__ anywhere in its MRO decides the whole list; otherwise the names are the default object.__dir__ gathers: the instance's own attributes, every name defined across its type's MRO, and the object base set, sorted and de-duplicated. ok is false when o is not an instance dir() enumerates here, so the caller raises its own "not supported" error.
func EncodeLong ¶
EncodeLong is pickle.encode_long: the minimal little-endian two's-complement byte string for an integer, empty for zero. pickletools imports the pure pickle.decode_long and pairs with this.
func EncodeStr ¶
EncodeStr encodes a str to bytes under the named codec and error handler, the exported entry the _codecs accelerator's per-codec encode functions call. It shares the codec switch str.encode and the two-argument bytes constructor use, so the utf-8, ascii and latin-1 families and their error wording stay in one place.
func ExcClass ¶
ExcClass returns the synthesized class object for a built-in exception name, resolving the EnvironmentError and IOError aliases to OSError so IOError is OSError holds. ok is false for a name that is not a built-in exception.
func ExcClassNames ¶
func ExcClassNames() []string
ExcClassNames lists every built-in exception name that reads as a value, including the two OSError aliases, so the runtime can register them all.
func ExcMatchesClass ¶
ExcMatchesClass reports whether a raised exception is caught by one except matcher, given as a class value. A non-class matcher, or one that is not an exception class, matches nothing here; the mismatched-matcher TypeError is a later slice. Matching walks the exception's class MRO, so a user subclass is caught by any built-in or user base it derives from.
func ExcMessageLine ¶
ExcMessageLine is the final traceback line with a user __str__ dispatched: "Kind: str(e)", or the bare kind when str is empty. Error uses the built-in Text, so the traceback renderer calls this instead to honour a subclass that overrides __str__.
func FloatInf ¶
FloatInf returns positive or negative IEEE-754 infinity as a float64, sign picking the direction the way math.Inf does. A Python float literal that overflows the double range folds to an infinity at compile time (1e400 is inf), and the lowering emits a call to this rather than a bare Go +Inf, which is not a valid Go literal, so an overflowing float or imaginary literal compiles instead of failing the Go build.
func FloatNaN ¶
func FloatNaN() float64
FloatNaN returns an IEEE-754 quiet NaN as a float64, the value a folded non-finite float literal that is not an infinity carries. The lowering emits a call to this for the same reason it uses FloatInf: NaN has no Go literal spelling. The bit pattern is CPython's canonical quiet NaN 0x7ff8...0000, not Go's math.NaN() which sets the low payload bit (0x7ff8...0001); the canonical form keeps struct.pack, float.hex and float.fromhex byte-identical with CPython for every constructor and constant NaN source. A NaN produced by arithmetic (float("inf") - float("inf")) still carries whatever sign the host FPU picks, which is platform-dependent and outside this value.
func FunctionStr ¶
FunctionStr spells a callee for the unpacking error messages: functions get the module-qualified name, builtins their bare name, and anything else its str, parentheses only on the callables.
func GenericDelAttr ¶
GenericDelAttr deletes o.name with object.__delattr__ semantics, skipping any __delattr__ the type defines. A runtime __delattr__ implementation calls it to fall through to the default delete for the names it does not manage, without re-entering its own hook.
func HandledLen ¶
func HandledLen() int
HandledLen reports the handled-stack depth, so a test can verify the bracketing stays balanced and reset between cases.
func HashlibAlgoNames ¶
func HashlibAlgoNames() []string
HashlibAlgoNames returns the names of every provided algorithm, backing _hashlib.openssl_md_meth_names.
func HmacDigest ¶
HmacDigest computes a one-shot HMAC, backing _hashlib.hmac_digest.
func IntAsDoubleChecked ¶
IntAsDoubleChecked converts an int or bool to a double, reporting ok false when the magnitude overflows the double range. It matches CPython's PyLong_AsDouble raising OverflowError, which math.sumprod catches to fall out of its float fast path onto exact object arithmetic.
func IsBigInt ¶
IsBigInt reports whether o is an int too large for int64. Index and repeat-count consumers use this to pick the "cannot fit" wordings.
func IsBuiltinTypeName ¶
IsBuiltinTypeName reports whether name is a builtin whose constructor doubles as a type object (int, str, list, ...), so TypeOf can hand back that constructor as the value's type.
func IsByteArrayInstance ¶
IsByteArrayInstance reports whether o is a bytearray value, a subclass instance included, the way CPython's PyByteArray_Check does, so sum() can refuse a bytearray start value with its own wording.
func IsBytesInstance ¶
IsBytesInstance reports whether o is a bytes value, a subclass instance included, the way CPython's PyBytes_Check does. It is stricter than AsBytesLike, which also accepts bytearray and memoryview, so sum() can refuse a bytes start value while still allowing a memoryview one.
func IsCContiguousBuffer ¶
IsCContiguousBuffer reports whether the bytes-like object o exposes a C-contiguous buffer. Only a memoryview can be non-contiguous, a strided slice such as m[::2] or m[::-1]; bytes, bytearray and array always are. A codec that needs a flat span, such as binascii, consults this to raise the BufferError CPython's PyBUF_C_CONTIGUOUS buffer request raises rather than reading the underlying memory out of order. A released view is reported non-contiguous, but AsBufferBytes already rejects one as not bytes-like before this is reached.
func IsChainMap ¶
IsChainMap reports whether o is a collections.ChainMap, so a mapping copy such as dict(cm) reads it by keys through the item protocol rather than mistaking it for an iterable of pairs. CPython's dict constructor branches the same way on the keys() method a ChainMap carries.
func IsCoreCodec ¶
IsCoreCodec reports whether name is one of the utf-8, ascii or latin-1 families the core encodeStr/decodeCodec path handles directly, without the encodings package and its runtime registry. The build reads it to decide whether a str.encode/bytes.decode (or two-argument str/bytes constructor) reaches a codec that needs encodings compiled in, so a program that only touches the core codecs never drags the encodings package along.
func IsCoroutineObject ¶
IsCoroutineObject backs asyncio.iscoroutine. It reports whether o is a coroutine, the object an async def call produces. Coroutines are the *generatorObject the frame machinery drives with isCoro set; an async generator carries isAsyncGen instead and is not a coroutine, matching CPython where iscoroutine is false for async generators.
func IsDict ¶
IsDict reports whether o is a dict or a dict subclass such as collections.defaultdict, so a caller that special-cases a mapping catches every dict-backed object regardless of its type name.
func IsDictBackedInstance ¶
IsDictBackedInstance reports whether o is an instance of a dict subclass with an allocated mapping store, so dict(o) and other mapping copies treat it as a mapping to read by keys rather than an iterable of pairs, the way CPython copies a dict subclass through PyDict_Merge.
func IsExactInt ¶
IsExactInt reports whether o is exactly the built-in int type, excluding bool and int subclasses, matching CPython's PyLong_CheckExact. math.sumprod reserves its exact-integer accumulator for these so bool operands take the float path the way CPython routes them.
func IsExcClassValue ¶
IsExcClassValue reports whether a value is a class deriving from BaseException, the check an except matcher must pass. A matcher that fails it is the "catching classes that do not inherit from BaseException" TypeError.
func IsExcGroupClass ¶
IsExcGroupClass reports whether name is one of the two exception group classes.
func IsExceptionClass ¶
IsExceptionClass reports whether name is a builtin exception class, counting the OSError aliases.
func IsFutureObject ¶
IsFutureObject backs asyncio.isfuture. It reports whether o is an asyncio Future or Task, the two objects the loop awaits natively. A concurrent.futures.Future is a different type and is not an asyncio future, matching CPython where isfuture is false for it.
func IsList ¶
IsList reports whether o is a real list or a list subclass instance, the test CPython's PyList_Check makes when a C accelerator (heapq, for one) insists its argument be a list before it manipulates the underlying array in place.
func IsTypeValue ¶
IsTypeValue reports whether o is itself a type object: a user or built-in class or one of the typeObject singletons. type() of any of these is the `type` metatype.
func MarshalDumps ¶
MarshalDumps serializes o to a marshal byte stream, or returns a ValueError for a value marshal does not support.
func MatchClass ¶
MatchClass gates a class pattern (`case Cls(pos..., kw=...)`). cls must be a user class or a builtin type; anything else raises the probed "called match pattern must be a class" TypeError regardless of the subject. A builtin type routes to matchBuiltinClass for its self-match rules. When subj is not an instance of cls the pattern simply does not match, so ok is false with no error. On a match it resolves the attribute names the sub-patterns bind to: the first nPos through the class's __match_args__ (validated as a tuple of strings, with the too-many / non-tuple / non-string TypeErrors), then kwNames appended in order. A keyword naming an attribute a positional slot already claimed raises the multiple-sub-patterns TypeError. The returned slice lines up with the sub-patterns the caller matches: positional first, then keyword.
func MatchMapping ¶
MatchMapping reports whether a subject matches a mapping pattern, which in the boxed tier means a dict.
func MatchSequence ¶
MatchSequence reports whether a subject matches a sequence pattern. Per PEP 634 that is any sequence except str, bytes, and bytearray; in the boxed tier the matching sequences are list, tuple, and range.
func Matches ¶
Matches reports whether an exception of the given kind is an instance of class, walking the base table. Both dual bases of ExceptionGroup count, like real MRO membership would.
func MissingArgsMsg ¶
MissingArgsMsg is the missing-required-arguments error; kind is "positional" or "keyword-only".
func MutableBuffer ¶
MutableBuffer exposes the writable bytes behind a read-write buffer object for an in-place byte writer like struct.pack_into. It returns the current bytes to write into and a commit callback that pushes them back to the object once the writer is done. commit is a no-op when buf is already the object's live storage (a bytearray or a bytearray-backed memoryview), and it re-decodes the bytes into the elements for an object that does not store a flat byte buffer (an array or an array-backed memoryview). ok is false for a read-only or non-buffer object; a memoryview must be writable and C-contiguous, so a read-only or strided view declines the way CPython's PyObject_GetBuffer with PyBUF_WRITABLE does.
func NewBarrier ¶
NewBarrier builds a filling barrier for the given number of parties. A nil action runs nothing on the tripping party.
func NewBoundedSemaphore ¶
func NewBoundedSemaphore(value int) *semaphoreObject
NewBoundedSemaphore builds a BoundedSemaphore, a semaphore that also caps release at its initial count.
func NewCondition ¶
NewCondition builds a Condition over lock, or over a fresh RLock when no lock is given, which is CPython's default. A supplied lock must be one of the native locks; that is what carries the owner and release-save protocol wait needs.
func NewExecutor ¶
NewExecutor builds a ThreadPoolExecutor with the given worker cap and thread name prefix. An empty prefix takes the default "ThreadPoolExecutor-N" stem, consuming the next pool number, so a worker's threading.current_thread().name reads the way CPython spells it.
func NewFrame ¶
func NewFrame(back *frameObject, globals *Module, file, name, qual string, firstline int, optimized bool) *frameObject
NewFrame builds a frame for the shadow stack. back links to the caller frame, globals is the module the frame runs in (may be nil), file/name/qual/firstline seed the code object, and optimized marks a function frame (fast locals) apart from a module or class body, which decides whether f_locals is a proxy or the namespace dict.
func NewFuture ¶
func NewFuture() *futureObject
NewFuture builds a pending Future with no result yet.
func NewLifoQueue ¶
func NewLifoQueue(maxsize int) *queueObject
NewLifoQueue builds a LifoQueue: a last-in first-out queue whose get returns the most recently put item.
func NewLock ¶
func NewLock() *lockObject
NewLock builds an unlocked Lock, its channel pre-loaded with the free token.
func NewPriorityQueue ¶
func NewPriorityQueue(maxsize int) *queueObject
NewPriorityQueue builds a PriorityQueue: get returns the smallest item under Python's <, keeping the item slice as a binary heap the way CPython does.
func NewQueue ¶
func NewQueue(maxsize int) *queueObject
NewQueue builds a Queue with the given maxsize. A maxsize of zero or below is CPython's unbounded queue.
func NewSemaphore ¶
func NewSemaphore(value int) *semaphoreObject
NewSemaphore builds a Semaphore with the given initial count.
func NewSimpleQueue ¶
func NewSimpleQueue() *simpleQueueObject
NewSimpleQueue builds an empty, unbounded SimpleQueue.
func ParseComplex ¶
ParseComplex parses complex()'s string form: an optional parenthesized body, then a real part, an imaginary part, or "real +/- imagj", with j or J marking the imaginary unit. It reports ok=false for any malformed string, which the caller turns into the ValueError. Underscores are allowed only between digits.
func Pbkdf2Hmac ¶
Pbkdf2Hmac derives a key with PBKDF2-HMAC, backing _hashlib.pbkdf2_hmac. A dklen of zero means the underlying digest size, the default hashlib applies when dklen is None.
func PickleDumps ¶
PickleDumps serializes o at the given protocol, returning the pickle bytes. proto is clamped and validated by the caller (the pickle module surface); it must be in the binary range 2..5 for this slice.
func PosOnlyKwMsg ¶
PosOnlyKwMsg is the error for positional-only names arriving as keywords on a function without **kwargs.
func PushHandledExc ¶
func PushHandledExc(err error)
PushHandledExc records err as the exception now being handled. A non exception err pushes a nil slot so PopHandledExc stays balanced.
func QualifyBuiltin ¶
QualifyBuiltin records the module-qualified name a builtin function reports in its argument errors, so math.comb() carries its module prefix the way CPython's C functions do while __name__ stays the bare name. It is a no-op for anything that is not a plain builtin function.
func RegisterPickleBuiltin ¶
RegisterPickleBuiltin records a builtin object (a type or function) under its (module, qualname) so the pickler can reference it by name and the unpickler can resolve it back. The runtime calls this as a builtin module initialises, the twin of RegisterPickleFunction for the compiled-def case.
func RegisterPickleFunction ¶
func RegisterPickleFunction(fn Object)
RegisterPickleFunction records a module-level function under its (module, qualname) so an unpickler can resolve a global reference back to it. A compiled module-level def emits a call to this after building the function object. A value that is not a plain function (a decorator may have replaced it) is ignored, matching that only the function itself is reachable by name.
func RegisterPickleModuleFunc ¶
RegisterPickleModuleFunc records a native module function under its (module, qualname) so it pickles as that global and an unpickler resolves the reference back to it, the way CPython pickles math.sqrt as the math.sqrt global read off its __module__/__qualname__. It registers only a builtin function object; a module constant (math.pi) or other value passed through the same module-init choke point is left alone, since only the function is reachable by name and the constant already pickles as its own value.
func Repr ¶
Repr returns the Python repr of an object. This infallible form serves error messages and internal rendering; it ignores the 4300-digit int conversion limit, which only the user-visible boundaries enforce.
func ReprE ¶
ReprE is repr() as user code reaches it: identical to Repr except that an int (anywhere in a container tree) past the 4300-digit conversion limit raises the probed ValueError.
func ReversedInstance ¶
ReversedInstance drives reversed(o) for a user class instance. A __reversed__ method wins and its result comes back as-is. Otherwise a class defining both __len__ and __getitem__ is an old-style sequence, so o[n-1]..o[0] is read into a slice for the caller to wrap. A class with neither is the not-reversible TypeError. mode is ReversedNotInstance for anything that is not a user instance, so the runtime falls through to its builtin cases.
func SetAdd ¶
SetAdd inserts one element into a set, the per-iteration add behind set comprehensions. Unhashable elements fail with the set-element wording.
func SetBuiltinAttr ¶
SetBuiltinAttr attaches an attribute to a builtin function object, the hook a runtime module uses to hang a helper off a builtin, such as chain.from_iterable. It is distinct from StoreAttr, which still refuses attribute assignment on a builtin the way user code sees it. fn must be a builtin function value from NewFunc.
func SetSiteWrite ¶
func SetSiteWrite(w func(string))
SetSiteWrite installs the sink _Printer/_Helper output goes to.
func SetSlice ¶
SetSlice implements o[lo:hi:step] = val for lists. A contiguous slice (step omitted or 1) splices the items of any iterable in, resizing the list; an extended slice needs an exact length match like CPython.
func SetStderrWrite ¶
func SetStderrWrite(w func(string))
SetStderrWrite installs the sink the loop's default_exception_handler writes to.
func SetZlibError ¶
func SetZlibError(cls Object)
SetZlibError records the zlib.error class for the streaming codec to raise.
func ShutdownExecutors ¶
func ShutdownExecutors()
ShutdownExecutors stops every live executor and joins its workers, the drain concurrent.futures._python_exit runs at interpreter shutdown. Emitted main calls it before it waits on the non-daemon threads, so a pool a program never shut down still runs its queued work to completion and lets its worker goroutines exit, rather than blocking the process forever.
func StoreAttr ¶
StoreAttr writes o.name = val. Instances and classes take new attributes; a builtin has no __dict__, which is the wording 3.14 gives.
func StoreAttrT ¶
StoreAttrT writes o.name = val for the thread t, routing a threading.local into t's private store and delegating every other receiver to StoreAttr.
func Str ¶
Str returns the Python str of an object. Strings come back raw, exceptions render their message, everything else falls through to Repr. Like Repr, this form skips the 4300-digit int conversion limit.
func StrE ¶
StrE is str() as user code reaches it, enforcing the 4300-digit int conversion limit that print, str() and f-strings all hit.
func StrFromRune ¶
StrFromRune builds a one-code-point str, writing a lone surrogate in WTF-8 so chr() can produce a surrogate string that round-trips. It is the exported form of writeStrRune for a single rune.
func StrFromRunes ¶
StrFromRunes builds a str from code points, writing any lone surrogate in its WTF-8 form so a decoder that yields surrogates as ordinary output (utf-7, and utf-16/utf-32 under surrogatepass) round-trips through str. It is the exported form of encodeStrRunes for callers outside this package.
func StrRunes ¶
StrRunes decodes a str's bytes to code points, recovering a lone surrogate from its WTF-8 form as one rune. It is the exported form of decodeStrRunes for callers outside this package (e.g. the ord builtin) that must see a surrogate as a single code point rather than three RuneError bytes.
func SuggestKeyword ¶
func SystemExitCode ¶
SystemExitCode maps an uncaught SystemExit to a process exit status the way CPython's runtime does: no code or a None code exits 0, an integer (or bool) code exits with that value, and any other code has its str written to stderr before exiting 1. The message writer is passed in so the runtime routes it through the same stderr sink the traceback printer uses. ok is false when the exception is not a SystemExit, so the caller falls back to a traceback.
func TooManyPosMsg ¶
TooManyPosMsg is the too-many-positional-arguments error. minReq counts the positional-capable parameters without defaults; given counts every positional the caller passed.
func TruthOf ¶
TruthOf is the fallible truth test used in every boolean context: an if, a while, the operands of and/or/not, an assertion, a comprehension filter and a match guard. For a user instance it drives __bool__ then __len__ the way CPython's PyObject_IsTrue does; a __bool__ must return an actual bool, a __len__ result is truthy when it is nonzero, and a class with neither is truthy. Every builtin defers to the non-fallible Truth, so this only ever raises for a user dunder.
func TypeValueName ¶
TypeValueName returns the display name of a type value: a user or built-in class, a typeObject singleton, or a built-in constructor that doubles as a type (str, int, ...). ok is false for a value that is not a type object, so a caller can tell "not a type at all" from "a type of the wrong kind".
func UnexpectedKwMsg ¶
UnexpectedKwMsg is the unexpected-keyword error, with CPython's did-you-mean suggestion drawn from the keyword-reachable names.
func WithEnter ¶
WithEnter runs the entry half of the context-manager protocol under the main thread, the wrapper a t-less caller takes.
func WithEnterT ¶
WithEnterT runs the entry half of the context-manager protocol: it looks up __exit__ then __enter__ on the manager's type, both before either is called, and returns the bound __exit__ to run on the way out together with the result of __enter__. A type missing either method raises the protocol TypeError probed on 3.14, which names __exit__ first when both are absent.
The ambient thread threads into both halves, so a with over a native manager like threading.RLock records and checks ownership against the goroutine that runs the with, not the main thread. The returned __exit__ closure captures the same thread, so it stays honest however the runtime invokes it on the way out.
Types ¶
type ClassBuilder ¶
type ClassBuilder struct {
// contains filtered or unexported fields
}
ClassBuilder carries one class statement's build from the header through the body to the metaclass call. meta is the winning metaclass when the explicit metaclass= argument is a class; callable is set instead when it is any other callable, which skips determination against the bases and simply receives (name, bases, ns) plus the class keywords, its return value bound to the class name whatever it is.
func StartClass ¶
func StartClass(meta Object, moduleName Object, name, qualSuffix string, firstLine int, doc Object, bases []Object, kwNames []string, kwVals []Object) (*ClassBuilder, error)
StartClass runs the class-statement header: metaclass determination, __prepare__, and the synthesized namespace members CPython writes before the body executes, __module__, __qualname__, __firstlineno__, and __doc__ when the body opens with a docstring (doc is nil otherwise). meta is the explicit metaclass= argument or nil; moduleName is the value the defining module's __name__ currently holds, the same read the class body's `__module__ = __name__` performs, so a module that reassigns __name__ (as _pydecimal does for pickling) has its classes report the reassigned name. qualSuffix is the bare __qualname__; the module segment is prepended here to form the module.qualname repr string. kwNames and kwVals are the remaining class keywords, which __prepare__ receives too.
func (*ClassBuilder) AnnotationLazy ¶
func (b *ClassBuilder) AnnotationLazy(name string, thunk func() (Object, error))
AnnotationLazy records one class-body variable annotation as an unevaluated thunk, PEP 649's deferred __annotate__. The class body no longer evaluates the annotation as it runs, so a forward reference or a name imported only under `if TYPE_CHECKING` costs nothing at class-definition time; the thunks run in order on the first C.__annotations__ read (see classAnnotations) and memoize into the class annotation dict. Because the annotation never lands in the namespace, `'__annotations__' in C.__dict__` stays false the way 3.14 reports.
func (*ClassBuilder) Delete ¶
func (b *ClassBuilder) Delete(name string) error
Delete removes a name the class body bound, the STORE_NAME namespace's DELETE_NAME. An except handler's as-name is bound on entry and deleted here on exit, so a later read of it in the body falls through and raises NameError. A missing key is a NameError the caller surfaces at the delete site; the default dict namespace reports it directly, and a custom __prepare__ mapping reports whatever its __delitem__ raises.
func (*ClassBuilder) Finish ¶
func (b *ClassBuilder) Finish(staticAttrs []string) (Object, error)
Finish writes the trailing synthesized member and runs the metaclass call. staticAttrs are the names the class's methods assign on self, already sorted; CPython's compiler synthesizes them as __static_attributes__ after the body bindings. The default metatype keeps the direct build; a user metaclass receives the namespace object itself.
func (*ClassBuilder) Load ¶
func (b *ClassBuilder) Load(name string) (Object, bool, error)
Load reads a name the class body may have bound in the namespace. ok is false when the namespace holds no such key, the class body's cue to fall through to the enclosing module and builtin scopes, matching the LOAD_NAME lookup order. The default dict namespace answers directly; a custom __prepare__ mapping is read through the item protocol so its __getitem__ observes the read, and a KeyError there is the same not-found fall-through.
type Deopt ¶
type Deopt struct {
Value Object
}
Deopt is the error-channel sentinel a static-tier function returns when an overflow guard fails and the computation hands off to its boxed twin. It is not a Python exception: Value is the boxed result the twin already produced, and the entry shim at the static-to-boxed boundary returns Value as the call's result rather than surfacing it as a raised error. Carrying the hand-off on the error channel lets the static form keep its own result in its native type, so only the deopt edge pays the boxing cost. A real *Exception raised inside the twin travels the same channel and stays an exception, so the shim tells the two apart by type.
type Exception ¶
type Exception struct {
Kind string
Args []Object
Frames []Frame
Cause *Exception // raise ... from X
Context *Exception // implicit chaining
SuppressContext bool // raise ... from None, or an explicit cause
// Notes holds PEP 678 add_note strings. The traceback renderer prints
// each one verbatim after the final exception line.
Notes []string
// Group holds the sub-exceptions when this is an ExceptionGroup or
// BaseExceptionGroup; nil for every other exception. Args still keeps
// the two constructor arguments, so repr echoes the given sequence.
Group []*Exception
// TBSet marks that with_traceback stored an explicit __traceback__, so a
// read returns TB verbatim (including None) instead of projecting Frames.
// This keeps unittest's `exc.with_traceback(None)` reading back None while a
// caught exception that was never overridden still exposes its frame chain.
TBSet bool
TB Object
// Reraised marks a bare `raise` so the next TB call skips its frame.
// CPython 3.14 keeps the original raise-site line for the re-raising
// function and adds no entry for the bare raise itself.
Reraised bool
// Class is the exception's class object when it is a user-defined
// exception subclass, so type(e), isinstance, and except matching key on
// the real class identity rather than the Kind string. It is nil for the
// built-in exceptions, whose Kind alone resolves back to a class through
// ExcClass.
Class *classObject
// Dict is the exception's __dict__, the per-instance attribute store a
// custom __init__ writes self.name into and a caught exception exposes.
// Every exception carries one in CPython; here it is allocated on first
// write so a plain built-in raise stays a bare struct until something
// actually sets an attribute. DictOrder records insertion order so
// __dict__ and vars() report attributes the way CPython's ordered dict
// does.
Dict map[string]Object
DictOrder []string
// OSError value slots. CPython's OSError splits 2..5 constructor arguments
// into the named attributes errno, strerror, filename and filename2, collapses
// args to the (errno, strerror) pair, and renders str() as
// "[Errno errno] strerror: 'filename' -> 'filename2'". These live in dedicated
// slots, not Dict, so they stay out of __dict__/vars() the way CPython's
// C-level members do. OSParsed marks that the split ran, so Text and the
// attribute reads use these rather than the raw args.
OSParsed bool
OSErrno Object
OSStrError Object
OSFilename Object
OSFilename2 Object
// UnicodeError value slots. CPython's UnicodeEncodeError/UnicodeDecodeError take
// exactly (encoding, object, start, end, reason) and UnicodeTranslateError takes
// (object, start, end, reason); it exposes each as a named attribute and renders
// str() as the "'enc' codec can't decode byte ..." form. These live in dedicated
// slots, not Dict, matching CPython's C members. UEParsed marks that the split
// ran, so Text and the attribute reads use these rather than the raw args.
UEParsed bool
UEEncoding Object
UEObject Object
UEStart Object
UEEnd Object
UEReason Object
// contains filtered or unexported fields
}
Exception is the error type raised by all runtime operations and the object bound by `except ... as e`. Kind is the Python class name and Args the constructor arguments, so str/repr can match CPython.
func AsRaisable ¶
AsRaisable converts a raised value to the exception it raises. An exception object raises itself; a bare exception class instantiates with no arguments the way `raise ValueError` does. ok is false for anything that cannot be raised, which the caller turns into CPython's derive-from-BaseException TypeError.
func CombineStar ¶
CombineStar folds the exceptions raised by except* handlers back together with the unhandled remainder into the exception that leaves the try, nil when everything was handled and nothing re-raised. Probed on 3.14: the remainder alone propagates as itself, a single raised exception with no remainder propagates bare, and any other mix wraps into an empty-message ExceptionGroup with the raised exceptions first and the remainder last.
func CurrentHandled ¶
func CurrentHandled() *Exception
CurrentHandled returns the exception being handled right now, or nil when no handler is active or the innermost slot holds a non-Python error.
func NewException ¶
NewException builds an *Exception carrying explicit argument objects, the ExceptionClass(args...) path.
func NewUnicodeDecodeError ¶
NewUnicodeDecodeError builds a structured UnicodeDecodeError from the full input bytes and the bad span, so the raised exception exposes the encoding/object/start/end/reason attributes an error handler reads and still renders str() in the codec-message form. It is the structured counterpart of the preformatted-message Raise form, for the runtime codec raise sites. The implicit context chains the way Raise does.
func NewUnicodeEncodeError ¶
NewUnicodeEncodeError builds a structured UnicodeEncodeError from the full input string and the bad span, the encode-side counterpart of NewUnicodeDecodeError. The object is the whole input so .start/.end index into it and str() can name the offending character.
func Raise ¶
Raise builds an *Exception with one formatted string argument. This is the constructor every preformatted-message call site uses, and every call site raises what it builds, so the implicit context chains on here the way CPython's PyErr_SetObject does: the exception being handled right now, if any, becomes the new one's context. A fresh object cannot form a cycle, so the plain assignment needs none of chainInto's unlinking.
func SplitStar ¶
SplitStar partitions e by whether each leaf matches any of kinds. It returns the matched part and the unhandled remainder, either of which may be nil. A group keeps its message and structure in both halves, dropping only the branches that went the other way. A naked exception that matches comes back wrapped in an empty-message ExceptionGroup, which is what an except* clause binds; an unmatched naked exception stays naked in rest.
func SplitStarValues ¶
SplitStarValues partitions e exactly like SplitStar but matches each leaf against except* matchers given as class values, the same class-value matching plain except uses, so a user exception subclass is caught by itself or any base it derives from. The matchers are assumed already validated as exception classes; the runtime rejects a non-class matcher before it reaches here.
func WrapGroup ¶
WrapGroup wraps a naked exception in an empty-message ExceptionGroup, the form except* binds when the raised exception is not already a group. Probed on 3.14: except* ValueError as e over raise ValueError binds e to an ExceptionGroup with an empty message wrapping the ValueError.
func (*Exception) Error ¶
Error is the final traceback line: "Kind: str", or the bare kind when str(e) is empty, matching `raise ValueError` vs `raise ValueError("x")`.
type Frame ¶
Frame is one traceback entry: where the exception passed through on its way out. Frames collect innermost raise site first.
type Iterable ¶
Iterable lets object types defined outside this package, like the runtime's enumerate and zip objects, plug into Iter.
type LengthHinter ¶
LengthHinter is implemented by an iterator that knows how many elements remain, which is what backs __length_hint__ and operator.length_hint. A cursor over a fixed-size sequence answers it; an open-ended source (a generator, map, filter) does not, so those iterators report no __length_hint__ the way CPython's do.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module is a Python module object. Its namespace is split in two: slots are live pointers into the generated Go package's module-scope variables, bound by the module's Exec before the body runs, so an attribute read or write from outside and a global read inside the module body see the same storage. extra holds everything else: the identity attributes seeded at creation and any new name assigned from outside, in insertion order. A nil slot value means the name is currently unbound, the state before its first assignment and after a del.
func NewBuiltinModule ¶
NewBuiltinModule builds a module the runtime provides itself, like sys. A built-in module has no source file, so __file__ is never seeded and reading it raises AttributeError the way CPython's sys.__file__ does; __package__ is the empty string since built-ins live at top level.
func NewModule ¶
NewModule builds an empty module with its identity attributes seeded the way CPython's module_from_spec does, so m.__name__ and m.__file__ read back and stay overwritable like ordinary attributes.
func (*Module) Bind ¶
Bind registers one module-scope name as a live slot over the generated package variable holding it. Exec calls it for every module-scope binding before the body runs, which is what gives an import cycle CPython's partial-module view.
func (*Module) FinishInit ¶
func (m *Module) FinishInit()
func (*Module) GlobalsDict ¶
GlobalsDict returns the module namespace as a dict, the value Python's globals() builtin gives. unagi keeps module globals in live Go variables rather than one dict object, so the returned dict is seeded with the names bound when it is called: reads, iteration, and membership match CPython, and type(globals()) is dict holds because the result is an ordinary dict. It is tied to the module through owner, so a write back to it, globals()[name] = value or globals().update(...), carries into the module storage and a later module-scope read finds the injected name. Order is the identity attributes first, then the module-scope names in the order they were bound; a name held in both a slot and the overflow store keeps its live slot value.
func (*Module) Initializing ¶
func (*Module) PublicNames ¶
PublicNames lists the names a `from m import *` copies when the module defines no __all__: every bound name that does not start with an underscore, the overflow store first and then the live slots, each in binding order. It is a runtime view, so a name the module injected through globals() is included the same as a statically assigned one.
func (*Module) SetGlobal ¶
SetGlobal binds a name in the module namespace from outside the body, the entry a star import uses to copy a source module's names in. It writes through a live slot when the name is one, so functions inside the module see it, otherwise the name lands in the overflow store.
type Object ¶
type Object interface {
TypeName() string
}
Object is the universal boxed value.
var ( StaticMethodBuiltin Object = NewFunc("staticmethod", -1, func(args []Object) (Object, error) { if len(args) != 1 { return nil, Raise(TypeError, "staticmethod expected 1 argument, got %d", len(args)) } return NewStaticMethod(args[0]), nil }) ClassMethodBuiltin Object = NewFunc("classmethod", -1, func(args []Object) (Object, error) { if len(args) != 1 { return nil, Raise(TypeError, "classmethod expected 1 argument, got %d", len(args)) } return NewClassMethod(args[0]), nil }) PropertyBuiltin Object = NewFuncKw("property", func(pos []Object, kwNames []string, kwVals []Object) (Object, error) { if len(pos) > 4 { return nil, Raise(TypeError, "property() takes at most 4 arguments (%d given)", len(pos)) } slots := [4]Object{} for i := 0; i < len(pos) && i < 4; i++ { slots[i] = pos[i] } names := [4]string{"fget", "fset", "fdel", "doc"} for i, kn := range kwNames { idx := -1 for j, n := range names { if n == kn { idx = j break } } if idx < 0 { return nil, Raise(TypeError, "'%s' is an invalid keyword argument for property()", kn) } slots[idx] = kwVals[i] } return &propertyObject{ fget: noneToNil(slots[0]), fset: noneToNil(slots[1]), fdel: noneToNil(slots[2]), doc: noneToNil(slots[3]), }, nil }) )
The builtin singletons for the three descriptor constructors. They are funcObjects so a call site treats them like any other builtin; the arity wordings are the ones CPython gives, which the generic funcObject check does not match, so each does its own count.
var ( None Object = &noneObject{} True Object = &boolObject{v: true} False Object = &boolObject{v: false} Ellipsis Object = &ellipsisObject{} )
The singletons. Identity checks (Is) rely on these being unique pointers.
var ArrayReconstructor Object
ArrayReconstructor is array._array_reconstructor, the pickling hook that rebuilds an array from its raw machine bytes. It lives in pkg/runtime (next to the array module registration) but the protocol-3-and-up reduction built here names it as the reduction callable, so pkg/runtime sets this at import time. It stays nil until the array module has been imported, which is always the case when an actual array object exists to reduce.
var CachedPropertyBuiltin Object = NewFunc("cached_property", -1, func(args []Object) (Object, error) { if len(args) != 1 { return nil, Raise(TypeError, "cached_property expected 1 argument, got %d", len(args)) } return NewCachedProperty(args[0]), nil })
CachedPropertyBuiltin is the functools.cached_property constructor. It takes the one function argument, the shape the @cached_property decorator uses.
var NotImplemented Object = ¬ImplementedObject{}
NotImplemented is the singleton user code returns from __add__ and friends. Identity against this pointer is how the dispatch recognizes a declined op.
var Placeholder Object = &placeholderObject{}
Placeholder is the single functools.Placeholder instance. _functools exposes it and the vendored functools.py rebinds Placeholder to it, so user code and the native partial share one sentinel.
func AsCompleted ¶
AsCompleted implements concurrent.futures.as_completed(fs, timeout). It returns an iterator over the futures in completion order. The timeout bounds the whole consumption from this call, the deadline CPython pins with end_time.
func AsyncIterT ¶
AsyncIterT obtains the async iterator for an async for. It calls __aiter__ on the object under the ambient thread and checks, before the loop starts, that the result implements __anext__. An object with no __aiter__, or one whose __aiter__ returns a value with no __anext__, is the TypeError CPython raises, wording and all.
func AsyncNextT ¶
AsyncNextT advances an async for one step: it calls __anext__ on the async iterator, awaits the awaitable through the frame's yielder, and reports the value. A raised StopAsyncIteration is exhaustion, reported as ok false so the loop breaks; any other error propagates. The (value, ok, err) shape mirrors the sync iterator's Next, so the async for loop body is the sync one.
func AsyncioAllTasks ¶
AsyncioAllTasks implements asyncio.all_tasks(loop=None). It returns a set of the loop's not-yet-done tasks. A nil loop means the running loop; called with no running loop and no explicit loop it is the RuntimeError asyncio raises.
func AsyncioAsCompleted ¶
AsyncioAsCompleted implements asyncio.as_completed(aws, timeout). It wraps each awaitable in a future the way ensure_future does, registers a completion callback on each, and arms the timeout timer when one is set. Bare coroutines are allowed here, unlike wait: they become tasks.
func AsyncioBrokenBarrierErrorClass ¶
func AsyncioBrokenBarrierErrorClass() Object
AsyncioBrokenBarrierErrorClass returns asyncio.BrokenBarrierError, a RuntimeError subclass distinct from threading.BrokenBarrierError, built the first time it is asked for so the RuntimeError base already exists.
func AsyncioCancelledErrorClass ¶
func AsyncioCancelledErrorClass() Object
AsyncioCancelledErrorClass returns asyncio.CancelledError, the BaseException subclass a cancelled task or future raises.
func AsyncioCreateTask ¶
AsyncioCreateTask implements asyncio.create_task(coro): it schedules coro to run concurrently on the running loop and returns the Task at once, before the coroutine has run. Called outside a running loop it is the RuntimeError asyncio raises, and a non-coroutine argument is a TypeError.
func AsyncioCurrentTask ¶
AsyncioCurrentTask implements asyncio.current_task(loop=None). It returns the task whose coroutine is running on the loop, or None when a loop is running but no task currently is. A nil loop means the running loop; called with no running loop and no explicit loop it is the RuntimeError asyncio raises.
func AsyncioEnsureFuture ¶
AsyncioEnsureFuture implements asyncio.ensure_future(arg). A coroutine is scheduled as a task and the task returned; a task or future is handed back unchanged, so callers can treat any awaitable as a future. It needs a running loop to schedule a coroutine, the RuntimeError CPython's get_event_loop path raises here.
func AsyncioGather ¶
AsyncioGather implements asyncio.gather(*aws, return_exceptions=False). It runs every awaitable concurrently and returns a future that resolves to the list of their results in argument order once all finish. With return_exceptions off, the first child to raise resolves the gather with that exception; with it on, each child's exception takes its slot in the result list. The returned future is itself awaitable, so the caller writes await gather(...).
func AsyncioGetEventLoop ¶
AsyncioGetEventLoop is asyncio.get_event_loop(). A running loop wins; otherwise it returns the loop set by set_event_loop, and with neither it raises the RuntimeError CPython 3.14 raises now that the implicit-loop creation is gone.
func AsyncioIncompleteReadErrorClass ¶
func AsyncioIncompleteReadErrorClass() Object
AsyncioIncompleteReadErrorClass returns asyncio.IncompleteReadError, raised when EOF arrives before readexactly or readuntil has the bytes it was asked for.
func AsyncioInvalidStateErrorClass ¶
func AsyncioInvalidStateErrorClass() Object
AsyncioInvalidStateErrorClass returns asyncio.InvalidStateError, raised when result, exception, set_result, or set_exception runs against a future in the wrong state.
func AsyncioLimitOverrunErrorClass ¶
func AsyncioLimitOverrunErrorClass() Object
AsyncioLimitOverrunErrorClass returns asyncio.LimitOverrunError, raised when a readuntil separator search runs past the reader's buffer limit.
func AsyncioNewBarrier ¶
AsyncioNewBarrier builds asyncio.Barrier(parties). A parties below one is the ValueError CPython raises from the constructor.
func AsyncioNewCondition ¶
AsyncioNewCondition builds asyncio.Condition(lock=None). With no lock, or None, it makes a fresh one; a supplied asyncio.Lock is shared, matching CPython. Any other lock value is the TypeError CPython raises.
func AsyncioNewEvent ¶
func AsyncioNewEvent() Object
AsyncioNewEvent builds asyncio.Event(), a fresh event in the unset state.
func AsyncioNewEventLoop ¶
func AsyncioNewEventLoop() Object
AsyncioNewEventLoop builds a fresh, not-yet-running event loop, the object asyncio.new_event_loop hands back for the manual run_until_complete idiom that predates asyncio.run. The loop is bound to a running thread only when it is first driven, so its epoch starts now and loop.time counts from here.
func AsyncioNewFuture ¶
AsyncioNewFuture builds asyncio.Future() bound to the running loop. CPython falls back to get_event_loop when constructed outside a running loop, which in 3.14 is the deprecated path that spins up a fresh loop; this slice binds to the running loop and raises RuntimeError when there is none, since a Future is only useful driven by a loop and every fixture builds one inside asyncio.run.
func AsyncioNewLifoQueue ¶
AsyncioNewLifoQueue builds asyncio.LifoQueue(maxsize), whose get returns the most recently put item.
func AsyncioNewLock ¶
func AsyncioNewLock() Object
AsyncioNewLock builds asyncio.Lock(), an unlocked coroutine mutex.
func AsyncioNewPriorityQueue ¶
AsyncioNewPriorityQueue builds asyncio.PriorityQueue(maxsize), whose get returns the smallest item under Python's <, keeping the items as a binary heap.
func AsyncioNewQueue ¶
AsyncioNewQueue builds asyncio.Queue(maxsize), the FIFO. A maxsize of zero or less is unbounded, matching CPython. The finished event starts set, so join returns at once until the first put.
func AsyncioNewRunner ¶
AsyncioNewRunner builds asyncio.Runner(debug=None). The loop is not created until the runner is entered, run, or asked for its loop, so a Runner that is never used allocates none. debug is stashed for that lazy init.
func AsyncioNewSemaphore ¶
AsyncioNewSemaphore builds asyncio.Semaphore(value) or, when bounded, asyncio.BoundedSemaphore(value). A negative value is the ValueError CPython raises from the constructor.
func AsyncioNewStreamReader ¶
AsyncioNewStreamReader builds asyncio.StreamReader(limit). A limit of zero or less is the ValueError CPython raises, since the buffer bound must be positive.
func AsyncioNewTaskGroup ¶
func AsyncioNewTaskGroup() Object
AsyncioNewTaskGroup builds asyncio.TaskGroup(), an un-entered group. The loop and parent task are bound at __aenter__, when a running loop and a current task exist, matching CPython, which reads both from the entered block.
func AsyncioNewTimeout ¶
AsyncioNewTimeout builds asyncio.timeout(delay): the deadline is loop.time() plus delay computed now, so a None delay disables the timeout. It needs a running loop, the RuntimeError CPython raises from get_running_loop otherwise.
func AsyncioNewTimeoutAt ¶
AsyncioNewTimeoutAt builds asyncio.timeout_at(when): when is already an absolute loop-clock time, or None to disable. Unlike timeout it does not read the loop, matching CPython, which only stores the deadline here.
func AsyncioOpenConnection ¶
AsyncioOpenConnection implements asyncio.open_connection(host, port). It dials the address off the loop, then returns a (reader, writer) pair over the connection, the same shape start_server hands a handler.
func AsyncioQueueEmptyClass ¶
func AsyncioQueueEmptyClass() Object
AsyncioQueueEmptyClass returns asyncio.QueueEmpty, raised by get_nowait on an empty queue.
func AsyncioQueueFullClass ¶
func AsyncioQueueFullClass() Object
AsyncioQueueFullClass returns asyncio.QueueFull, raised by put_nowait on a full queue.
func AsyncioQueueShutDownClass ¶
func AsyncioQueueShutDownClass() Object
AsyncioQueueShutDownClass returns asyncio.QueueShutDown, raised by put and get once the queue has been shut down.
func AsyncioRun ¶
AsyncioRun implements asyncio.run(coro). It refuses to nest inside a running loop, then drives coro to completion on a fresh loop bound to this thread, returning its result or raising the exception it finished with. The running-loop check comes first, matching CPython, so a nested call is the RuntimeError even when its argument is not a coroutine.
func AsyncioRunT ¶
AsyncioRunT is AsyncioRun binding the loop to the calling thread, so a task's context swap acts on the same thread its coroutine reads. The t-less AsyncioRun routes the main thread in, matching a single-threaded program.
func AsyncioRunViaRunner ¶
AsyncioRunViaRunner implements asyncio.run(main, *, debug=None), which CPython defines as entering a Runner(debug=debug), calling run(main), and closing it. Routing through the Runner is what makes debug take effect: the loop is armed at lazy init, so a coroutine that reads get_running_loop().get_debug() sees it. The running-loop check comes first with asyncio.run's own message, before the Runner is built, and the loop is always closed on the way out, the way the with block runs __exit__ on both the normal and the error path.
func AsyncioRunningLoop ¶
func AsyncioRunningLoop() Object
AsyncioRunningLoop returns the loop bound to the current run for get_running_loop, or nil when no loop is running so the caller raises the RuntimeError asyncio raises outside a loop.
func AsyncioShield ¶
AsyncioShield implements asyncio.shield(arg). It returns a future that mirrors the inner awaitable's outcome but keeps the inner running when the outer is cancelled: a cancel of the returned future resolves it with CancelledError while the inner task carries on, its result simply discarded. An inner that is itself cancelled cancels the outer, and an inner exception or result copies across. An already-done inner is returned directly, the CPython shortcut.
func AsyncioSleep ¶
AsyncioSleep implements asyncio.sleep(delay, result=None). A non-positive delay is a bare yield through the ready queue, so the coroutine hands control back once and resumes without a timer. A positive delay creates a future the loop resolves after the delay, and the coroutine awaits it; the result is returned either way.
func AsyncioStartServer ¶
AsyncioStartServer implements asyncio.start_server(client_connected_cb, host, port). It binds a listener and begins accepting at once, the start_serving default, and returns the Server already listening.
func AsyncioToThread ¶
AsyncioToThread implements asyncio.to_thread(func, *args, **kwargs): it runs the call in the running loop's default thread pool and hands back the asyncio Future that resolves to its result, the convenience form of run_in_executor.
func AsyncioWait ¶
AsyncioWait implements asyncio.wait(aws, *, timeout=None, return_when=ALL_COMPLETED). It returns a coroutine that suspends until the return condition is met or the timeout elapses, then evaluates to the (done, pending) pair of sets. Unlike wait_for it never cancels the still-pending awaitables when the timeout fires; they are simply reported in the pending set. The awaitables must be Tasks or Futures, not bare coroutines, matching CPython 3.11's removal of the implicit wrapping.
func AsyncioWaitFor ¶
AsyncioWaitFor implements asyncio.wait_for(aw, timeout). It awaits aw, and if timeout seconds pass first it cancels aw and raises TimeoutError. A timeout of None waits forever, awaiting aw straight through. On success it returns aw's result; a coroutine or future argument that raises propagates that exception.
func Await ¶
Await turns an await operand into the object to delegate to, CPython's GET_AWAITABLE. A coroutine is awaitable as itself, so the delegating YieldFrom drives it directly. Any other object must supply __await__ returning an iterator; a plain generator or a value with neither is the TypeError CPython raises.
func AwaitThrough ¶
AwaitThrough awaits one awaitable through a yielder: it turns the operand into the iterator to drive with GET_AWAITABLE and delegates to it through the yielder's YieldFrom, the same two steps `await` lowers to. The async with enter and exit reuse it so their awaits behave exactly like a bare await.
func BackslashReplaceErrors ¶
BackslashReplaceErrors is the "backslashreplace" handler: replace each bad unit with its Python backslash escape. On decode the units are bytes (\xNN); on encode and translate they are characters (\xNN, \uNNNN or \UNNNNNNNN).
func BitAnd ¶
BitAnd implements the & operator: int bitwise and, set intersection. bool & bool stays bool like |.
func BitOr ¶
BitOr implements the | operator: int bitwise or, set union, dict union (PEP 584). Probed on 3.14: True | False is bool True, but mixing bool with int gives int; d1 | d2 needs both operands to be dicts.
func BitXor ¶
BitXor implements the ^ operator: int bitwise xor, set symmetric difference. bool ^ bool stays bool like |.
func BrokenBarrierErrorClass ¶
func BrokenBarrierErrorClass() Object
BrokenBarrierErrorClass returns the threading.BrokenBarrierError class object, building it against the RuntimeError class the first time it is asked for.
func BrokenExecutorClass ¶
func BrokenExecutorClass() Object
BrokenExecutorClass returns concurrent.futures._base.BrokenExecutor.
func BrokenThreadPoolClass ¶
func BrokenThreadPoolClass() Object
BrokenThreadPoolClass returns concurrent.futures.thread.BrokenThreadPool.
func BuiltinIntValue ¶
BuiltinIntValue returns the underlying int for an int, a bool, or a subclass of either, and ok false for anything else. Unlike a general __index__ probe it does not fire for an arbitrary object that merely spells __index__, so a caller that must treat only genuine integers as integral (math.trunc, whose argument rule rejects a bare __index__ object) can tell the two apart.
func BuiltinValue ¶
BuiltinValue exposes builtinUnwrap to callers in other packages, so a conversion such as int(x) or an index can read the payload of a value subclass instance. ok is false for every object that is not such an instance.
func ByteArrayOf ¶
ByteArrayOf implements the bytearray() constructor with positional arguments only, the entry other packages call.
func ByteArrayOfKw ¶
ByteArrayOfKw implements the bytearray() builtin, the mutable twin of BytesOfKw, so bytearray(source='hi', encoding='utf-8') binds the same way.
func BytesOf ¶
BytesOf implements the bytes() constructor with positional arguments only, the entry other packages call.
func BytesOfKw ¶
BytesOfKw implements the bytes() builtin, accepting the source, encoding and errors parameters by keyword the way CPython's clinic signature bytes(source, encoding, errors) does, so bytes(source=b'x') and bytes('hi', encoding='utf-8') both work.
func Call ¶
Call invokes a function object with positional arguments. It is the thread-state-less entry the secondary dispatch paths still use; the threaded spine calls CallT.
func CallEx ¶
CallEx invokes a callee with merged positional and keyword parts. It is the t-less entry; the threaded spine calls CallExT so a callee invoked through argument unpacking still runs under the caller's goroutine.
func CallKw ¶
CallKw invokes a callable with positional and keyword arguments. kwNames and kwVals run in parallel; the parser already rejected duplicate keywords at the call site. It is the thread-state-less entry the secondary dispatch paths still use; the threaded spine calls CallKwT.
func CallKwT ¶
CallKwT is CallKw threading the caller's Thread into a compiled callable, so a target invoked dynamically runs its body under the goroutine that called it and thread-identity lookups inside it are correct.
func CallMethod ¶
CallMethod dispatches o.name(args...) for the built-in types. It is the thread-state-less entry the secondary paths use; the threaded spine calls CallMethodT so an identity builtin reached through a receiver, such as threading.get_ident() on the threading module, sees the running goroutine.
func CallMethodEx ¶
CallMethodEx invokes a method with a merged positional slice and keyword dict. An empty keyword dict falls through to the plain method dispatch so the no-keyword path stays identical.
func CallMethodExT ¶
CallMethodExT is CallMethodEx threading the caller's Thread into the resolved method.
func CallMethodKw ¶
func CallMethodKw(o Object, name string, pos []Object, kwNames []string, kwVals []Object) (Object, error)
CallMethodKw dispatches o.name(pos, **kw) for receivers whose methods take keyword arguments: a user instance, class, or super object threads the keywords into the function binder, which spells the unexpected-keyword and arity errors against the method's qualname. A builtin receiver's methods are positional in this tier, so a keyword there raises the type.method() takes-no-keyword TypeError CPython gives for the builtin methods. With no keywords it is exactly CallMethod.
func CallMethodKwT ¶
func CallMethodKwT(t *Thread, o Object, name string, pos []Object, kwNames []string, kwVals []Object) (Object, error)
CallMethodKwT is CallMethodKw threading the caller's Thread into the leaf call, so a keyword method call runs under the goroutine that made it, the same split CallMethodT draws between thread-sensitive leaves and the positional built-in methods.
func CallMethodStar ¶
CallMethodStar invokes a method whose whole positional pack is one deferred *iterable. The wording spells the bound method the way CPython's _PyObject_FunctionStr does.
func CallMethodStarEx ¶
CallMethodStarEx invokes a method whose whole positional pack is a deferred *iterable and that also carries keyword parts. The star conversion error spells the receiver type the same way CallMethodStar does.
func CallMethodStarExT ¶
CallMethodStarExT is CallMethodStarEx threading the caller's Thread into the resolved method.
func CallMethodStarT ¶
CallMethodStarT is CallMethodStar threading the caller's Thread into the resolved method.
func CallMethodT ¶
CallMethodT is CallMethod threading the caller's Thread into the leaf call, so o.name(args) invokes a user method, module function, or identity builtin under the goroutine that made the call. The built-in type methods (int, str, list, and the rest) do not observe thread identity in this tier, so they keep the t-less dispatch; t reaches the leaves that run user or thread-sensitive code.
func CallStarEx ¶
CallStarEx invokes a callee whose whole positional pack is one deferred *iterable. The conversion error outranks the keyword str check but not the mapping and duplicate checks, which already fired at merge time.
func CallStarExT ¶
CallStarExT is CallStarEx threading the caller's Thread into the callee.
func CallT ¶
CallT is Call threading the caller's Thread into a compiled callable, so a target invoked dynamically runs its body under the goroutine that called it and thread-identity lookups inside it are correct.
func CancelledErrorClass ¶
func CancelledErrorClass() Object
CancelledErrorClass returns concurrent.futures.CancelledError, raised by result and exception on a cancelled future.
func ChainMapFromKeys ¶
ChainMapFromKeys is the exported form of the fromkeys classmethod, so the runtime can bind ChainMap.fromkeys on the constructor object as well as the instance-reached cm.fromkeys.
func ClassOf ¶
ClassOf returns the class of a user instance, the type object a user value's type() reports. A raised exception reports its built-in exception class, so type(e) is ValueError holds. ok is false for every other value, which TypeOf resolves by other means.
func CompareDigest ¶
CompareDigest is the constant-time equality of _hashlib.compare_digest. Two strings compare as ASCII (a non-ASCII string is rejected), otherwise both operands must be bytes-like; the comparison never short-circuits on content.
func ComplexNew ¶
ComplexNew builds a complex from the constructor arguments, either of which may be nil when the caller omitted it. A str real parses like a literal and forbids a second argument; numeric parts combine as real + imag*1j. The error wordings are probed on 3.14.
func ContextTokenClass ¶
func ContextTokenClass() Object
ContextTokenClass returns the contextvars.Token type object, exposed for the module so Token.MISSING can be read.
func CopyThreadContext ¶
CopyThreadContext returns a copy of thread t's current context, the value copy_context() gives back.
func CurrentThreadObject ¶
CurrentThreadObject returns the threading.Thread object for the thread whose state t is, the value threading.current_thread hands back. Every started thread records its wrapper before it runs, so a child reads its own Thread and the main goroutine reads _MainThread. A state with no wrapper (a bare Thread built outside the threading module, such as a static twin's re-entry) falls back to the main-thread object.
func DecodeBytes ¶
DecodeBytes decodes raw bytes to a str under the named codec and error handler, the exported entry the _codecs accelerator's per-codec decode functions call. It shares decodeCodec with bytes.decode and str(), so the utf-8, ascii and latin-1 families and their error wording stay in one place.
func DecodeBytesStateful ¶
DecodeBytesStateful decodes v the way DecodeBytes does but honors the incremental `final` flag. When final is false and the sole fault is a multibyte sequence cut short at the very end of the input, it holds those trailing bytes back instead of reporting an error, returning the decoded prefix and the count of bytes consumed so the caller can prepend the remainder to the next chunk. With final true, or when the input decodes cleanly, it behaves exactly like DecodeBytes and consumes the whole input. This is the (str, consumed) contract the _codecs.*_decode accelerators expose to the codecs module's stream and incremental readers.
func DivmodDunder ¶
DivmodDunder runs the __divmod__/__rdivmod__ protocol for a pair the builtin divmod path could not handle. divmod is not an infix operator, so it has no entry in opDunders, but CPython dispatches it through the same binary_op1 slots; this lets the runtime divmod builtin fall back to a type like timedelta that defines __divmod__. ok is false when neither operand participates, so the caller raises its own unsupported-operand message.
func ExcClass2 ¶
ExcClass2 is ExcClass panicking on a miss, the shape the lazy builders want since a missing built-in exception base is a build bug, not a runtime path.
func ExcClassValue ¶
ExcClassValue is ExcClass typed as an Object, the form the runtime registers as a builtin the same way it registers object.
func ExcNoKeywords ¶
ExcNoKeywords rejects the keyword parts of a builtin exception constructor the way every builtin exception type does and returns the positional slice for construction to carry on with. The key-stringness check runs first, so a non-string ** key raises "keywords must be strings" before the takes-no-keyword error; an empty keyword dict (a **{} that merged nothing) passes so normal construction proceeds. className is spelled bare, no module, matching the type's own error.
func ExcType ¶
ExcType returns the class object a with statement passes to __exit__ as its first argument on the exception path, the real first-class exception class for the kind. A kind with no registered class falls back to a bare type value, so __exit__ still receives a non-None class-like object.
func ExcTypeOf ¶
ExcTypeOf returns the class object for a raised exception, resolving it the way type(e) and except matching do: the carried Class for a user-defined subclass, otherwise the built-in class its Kind names. Passing the exception rather than just its Kind matters for a user subclass, whose Kind names no registered built-in, so a Kind-only lookup would hand back a bare type singleton that fails an identity or issubclass check against the real class (what unittest.assertRaises does under the hood). It falls back to a bare type value only for a kind with no class at all, so a caller still gets a non-None type.
func ExtendStar ¶
ExtendStar appends the elements of a *iterable to the positional slice. This is the in-position merge a call uses when the star argument sits among other positional parts, and its wording carries no function name.
func FlattenMatchers ¶
FlattenMatchers expands a tuple matcher value into its elements, the way an except or except* clause treats a tuple of exception classes. The expansion is one level only, matching CPython: a nested tuple element stays a tuple, fails the exception-class check, and raises the non-class TypeError rather than flattening further. A non-tuple value passes through unchanged.
func FloatFromDunder ¶
FloatFromDunder implements the instance fallback of float(o): a user object with __float__ converts through it, else one with __index__ converts through that. ok is false when o is not a user instance or defines neither, so the caller keeps its own "not a real number" TypeError. A __float__ must return a float and a __index__ an int, echoing CPython's own return-type messages.
func FuturesErrorClass ¶
func FuturesErrorClass() Object
FuturesErrorClass returns concurrent.futures._base.Error, the Exception subclass the other two derive from. It is not re-exported by concurrent.futures, but it is the shared base a program catches both leaf classes through.
func GetSlice ¶
GetSlice implements o[lo:hi:step] for list, str and tuple. A list slice is a new list; str and tuple slices keep their type.
func IDOf ¶
IDOf backs the id builtin: the object's address as a non-negative integer, unique and stable for the object's lifetime, so id(a) == id(b) exactly when a is b. Every object is a pointer-backed interface, so the address is the identity the is operator already compares. The value differs between runs, as CPython's addresses do, and the small-int and singleton caches make id(1), id(None) and id(True) stable within a run the way CPython's interning does.
func IgnoreErrors ¶
IgnoreErrors is the "ignore" handler: drop the bad span and resume after it.
func InPlace ¶
InPlace performs an augmented assignment operator. sym is the augmented spelling ("+=", "|=", ...). The result is the value to rebind to the target; for a mutable builtin or an in-place dunder returning self it is the same object, so aliases see the mutation.
func IndexOf ¶
IndexOf implements PyNumber_Index for a user instance: __index__ is called and must return an int, which is handed back as an int or big int Object. It is the lossless-integer coercion the range, bin/hex/oct, chr and sequence/slice subscription paths all consult before their own "not an integer" TypeError. ok is false when o is not a user instance defining __index__, leaving the caller's existing handling untouched, so no builtin fast path pays for the lookup.
func InstanceDict ¶
InstanceDict exposes an instance's own attributes as an ordered dict for the vars() builtin. A non-instance has no __dict__, which is the TypeError vars() gives on 3.14.
func InstanceDunder ¶
InstanceDunder calls o.name(args...) when o is a user instance whose class defines name, returning defined=false otherwise so the caller keeps its own error. It is the exported gate the round() and math.floor/ceil/trunc builtins use to reach a user numeric's __round__/__floor__/__ceil__/__trunc__ without routing an ordinary builtin argument through attribute machinery.
func InstanceOverride ¶
InstanceOverride runs a special method a user class defines on an instance, for a caller in another package that must try an override before its own builtin path. ok is false when o is not an instance or its class defines no such method, so the caller keeps its default behavior.
func Instantiate ¶
Instantiate builds an instance of a class and runs __init__. The binding errors come from the __init__ function object, so they spell C.__init__() exactly as a direct call would; a class with no __init__ rejects any argument with the takes-no-arguments message probed on 3.14.
func InstantiateT ¶
func InstantiateT(t *Thread, c *classObject, pos []Object, kwNames []string, kwVals []Object) (Object, error)
InstantiateT builds an instance for the constructing thread t. It matters only for a threading.local subclass, whose __init__ runs on the thread that creates the instance; every other class ignores t and builds the same instance a t-less call would. CallT threads the real caller here so `L(...)` on a worker thread primes that worker's per-thread dict.
func IntFromDunder ¶
IntFromDunder implements the instance fallback of int(o): __int__ wins when present, else __index__, each of which must return an int. ok is false when o is not a user instance or defines neither, leaving the caller's own TypeError.
func InvalidStateErrorClass ¶
func InvalidStateErrorClass() Object
InvalidStateErrorClass returns concurrent.futures.InvalidStateError, raised when set_result, set_exception, or set_running_or_notify_cancel runs against a future already past the state it expects.
func IsInstance ¶
IsInstance implements isinstance(obj, cls). cls is a class, a builtin type, or a tuple of those; anything else raises the arg 2 TypeError probed on 3.14. A user instance matches when cls is in its MRO or is the object root; a builtin value matches when its kind is or descends from the named builtin type.
func IsSubclass ¶
IsSubclass implements issubclass(sub, cls). sub is validated as a class or a builtin type first, matching CPython's arg 1 check that fires before arg 2; cls is a class, a builtin type, or a tuple of those. Every class is a subclass of object.
func IterBuiltinResult ¶
IterBuiltinResult implements the iter() builtin's contract for a user instance: iter(x) is type(x).__iter__(x), and it returns exactly the object __iter__ handed back. This is what lets an iterator whose __iter__ returns self satisfy iter(x) is x, and lets the result keep its own type instead of a generic handle. It reports ok=false for anything that is not a user instance defining __iter__, so the iter() builtin falls back to its wrapping Iter path (which drives internal for-loop iteration and old-style __getitem__ objects). A result that is not itself an iterator raises the TypeError CPython raises.
func IterToSlice ¶
IterToSlice drains any iterable into a slice, the shared read a structseq constructor and time.strftime both use to accept a tuple, list or struct_time.
func KwMerge ¶
KwMerge folds a **mapping into the accumulated keyword dict, checking mapping-ness and duplicates in argument position, before anything to the right of it evaluates.
func KwMergeFor ¶
KwMergeFor is KwMerge for a compile-time-known callee spelling.
func KwMergeM ¶
KwMergeM is KwMerge for a method call: it folds a **mapping into the keyword dict, spelling the mapping and duplicate errors against the method name.
func KwSet ¶
KwSet adds one literal name=value keyword to the accumulated dict. A collision means a **mapping earlier in the call already supplied the name; duplicated literal keywords never get this far, the parser rejects them like CPython's compiler does.
func KwSetFor ¶
KwSetFor is KwSet for a callee whose spelling is known at compile time, like an exception class. The funcstr arrives pre-rendered because no callee object exists to derive it from, mirroring StarArgsFor on the positional side.
func KwSetM ¶
KwSetM is KwSet for a method call: it adds one literal name=value keyword and spells a duplicate against the receiver-qualified method name.
func LShift ¶
LShift implements the << operator. Probed: True << True is int 2, so shifts never keep bool. Overflowing bits promote to big; a shift count past int64 raises unless the value is zero, in CPython's "too many digits in integer" wording.
func LoadAttr ¶
LoadAttr reads o.name as a value. On an instance the instance dict wins, then a class function binds to the instance and a class variable comes back as is; on a class the name comes straight from the class dict. The two AttributeError wordings, instance and type object, are probed on 3.14.
func LoadAttrT ¶
LoadAttrT reads o.name for the thread t, routing a threading.local through t's private store and delegating every other receiver to the thread-agnostic LoadAttr. Only threading.local cares which thread reads it; the rest of the attribute protocol is identical whoever asks, so the emitted x.attr code carries t here and pays nothing for it on ordinary objects.
func MainThreadObject ¶
func MainThreadObject() Object
MainThreadObject returns the Python threading.Thread for the process main thread, the singleton main_thread and current_thread hand back on the main goroutine.
func MarshalLoads ¶
MarshalLoads rebuilds the object a marshal stream encodes. Trailing bytes past the first complete object are ignored, matching CPython's reader.
func MatMul ¶
MatMul implements the @ operator. No builtin type defines matrix multiplication, so it goes straight to the dunder protocol and otherwise raises the unsupported-operand TypeError.
func MatchClassAttr ¶
MatchClassAttr loads subj.name for a class-pattern sub-pattern. A missing attribute makes the whole pattern fail rather than raise, so an AttributeError becomes ok=false; any other error propagates unchanged.
func MatchKeys ¶
MatchKeys checks that a mapping subject holds every key exactly once and returns the matched values in the same order. ok is false when any key is missing; a key equal to an earlier one raises the duplicate-key ValueError, like CPython when two value-pattern keys collide at runtime.
func MatchRest ¶
MatchRest copies a mapping subject minus the given keys into a fresh dict, preserving insertion order, for a mapping pattern's `**rest` capture.
func MatchStar ¶
MatchStar returns the middle run of a sequence subject as a fresh list: the elements after the first `before` and before the last `after`, matching the list a `*name` capture binds.
func MemoryViewOf ¶
MemoryViewOf implements the memoryview() builtin. It takes exactly one argument; zero and more than one give the two arity messages CPython raises before the bytes-like check.
func Mod ¶
Mod implements the % operator with floor semantics. A str left operand means percent formatting instead.
func NameReplaceErrors ¶
NameReplaceErrors is the "namereplace" handler: replace each unencodable character with \N{NAME} when it has a Unicode name, else the backslashreplace escape (\xNN, \uNNNN or \UNNNNNNNN). Encode only.
func NewArray ¶
NewArray builds an array.array from a typecode and an optional initializer, the way array.array(typecode[, initializer]) does. The typecode must be a length-1 str naming a valid code; the initializer, when present, is a bytes-like object read as machine values, a str (only for the unicode codes), or any other iterable whose items are each validated against the code.
func NewAsyncGenerator ¶
NewAsyncGenerator wraps a lowered async-generator body. It is a generator frame flagged as an async generator, so the frame stepper drives it while the public surface is the async-generator protocol.
func NewBZ2Compressor ¶
func NewBZ2Compressor() Object
NewBZ2Compressor builds a BZ2Compressor. The compresslevel argument is validated by the runtime module for the CPython signature; the object itself carries no state.
func NewBZ2Decompressor ¶
func NewBZ2Decompressor() Object
NewBZ2Decompressor builds a BZ2Decompressor. It takes no arguments; the trailing_error keyword _compression.DecompressReader passes is accepted and ignored by the runtime module before it reaches here.
func NewByteArray ¶
NewByteArray boxes a byte slice as a mutable bytearray. The caller hands off ownership of b; later mutation is guarded by the object's lock.
func NewBytes ¶
NewBytes boxes a byte slice as a bytes object. The caller must not mutate the slice afterwards; bytes are immutable.
func NewBytesIO ¶
NewBytesIO builds an io.BytesIO over the initial bytes.
func NewCachedProperty ¶
NewCachedProperty wraps fn as a cached_property descriptor.
func NewChainMap ¶
NewChainMap builds a ChainMap over the given mappings, wrapping them in the list object that becomes self.maps. With no mappings the list gets one empty dict, matching CPython's `self.maps = list(maps) or [{}]`, so there is always a first map to write through.
func NewClass ¶
func NewClass(name, qual string, bases []Object, names []string, vals []Object, kwNames []string, kwVals []Object) (Object, error)
NewClass builds a class object from its bases and the names its body bound. bases are the values of the base expressions in written order, with the implicit object base passed as nil so the lowering never has to name it; each real base must be a class. The C3 linearization runs here, so an inconsistent base order raises the same TypeError CPython does at class-creation time.
func NewClassMethod ¶
func NewComplex ¶
NewComplex boxes a real and imaginary part.
func NewContextVar ¶
NewContextVar builds a ContextVar with the given name and, when hasDefault is set, a default get returns before any value is set.
func NewCoroutine ¶
NewCoroutine wraps a lowered async def body as a coroutine object. A coroutine runs on the same frame as a generator, so calling an async def returns one of these; it differs only in type name, repr, that it is not iterable, and that await drives it. Real suspension against an event loop is a later milestone; a coroutine that never awaits runs to completion on the first send(None).
func NewCounter ¶
Counter is a dict subclass in CPython's collections: a multiset that maps each element to its count. Like defaultdict it is modeled as a dictObject with the counterDict kind, so it shares dict storage, equality (a Counter equals a plain dict with the same items), and hashing, and only overrides the missing key (which reads zero without storing), the repr, and the counting methods and arithmetic. NewCounter builds one over already-counted keys and values.
func NewCsvDialect ¶
NewCsvDialect builds a dialect from an optional base and format keywords, mirroring _csv's dialect_new. base may be nil (all defaults), a registered dialect object already resolved from a name by the caller, or any object whose attributes name the parameters (a csv.py Dialect class or instance). Keywords override the base. A base that is already a dialect and needs no override is returned unchanged, the reuse the C code performs.
func NewCsvReader ¶
NewCsvReader builds a reader over an iterable under a dialect. The iterable is turned into an iterator immediately, so a non-iterable argument raises here the way _csv does at construction.
func NewCsvWriter ¶
NewCsvWriter builds a writer over a file object under a dialect. The file must expose a callable write, the one method _csv requires.
func NewDefaultDict ¶
NewDefaultDict builds a defaultdict with the given factory over the initial keys and values. A None factory is allowed and disables the missing-key fill.
func NewDeque ¶
NewDeque builds a deque over the initial elements with the given bound, where maxlen < 0 means unbounded. The initial elements are trimmed to the bound from the left, matching deque(iterable, maxlen).
func NewDict ¶
NewDict builds a dict from parallel key and value slices, preserving insertion order. Later duplicates overwrite the value but keep the first key object, like CPython.
func NewDictUnpack ¶
NewDictUnpack builds a dict display that contains one or more `**mapping` unpackings. A nil key marks its value as a mapping to merge; any other key is an ordinary entry. Entries apply left to right and a later key wins, the order CPython's BUILD_MAP and DICT_UPDATE give a display. Unlike a `**` in a call, a duplicate key is not an error and a key may be any hashable, not just a string; a value that is not a mapping raises TypeError.
func NewEmptyContext ¶
func NewEmptyContext() Object
NewEmptyContext builds a fresh contextvars.Context with no variables set, the object contextvars.Context() hands back.
func NewExcGroup ¶
NewExcGroup constructs an exception group. Args keeps the two constructor arguments as given so repr can echo the original sequence, and Group holds the extracted sub-exceptions.
func NewExceptionKw ¶
NewExceptionKw constructs a builtin exception from positional arguments and a merged keyword dict, the ExceptionClass(args, kw=v) path. Most builtin exceptions take no keywords and raise the takes-no-keyword TypeError for any; the ImportError family accepts name and path and stores them as instance attributes, which importlib's bootstrap reads back off the raised error. An empty keyword dict (a **{} that merged nothing) constructs the same as the no-keyword path. className is spelled bare, matching the type's own errors.
func NewFrozenset ¶
NewFrozenset builds a frozenset from elements.
func NewFunc ¶
NewFunc wraps a Go function as a callable object. A negative arity disables the positional argument count check; builtins use that.
func NewFuncKw ¶
func NewFuncKw(name string, kwfn func(pos []Object, kwNames []string, kwVals []Object) (Object, error)) Object
NewFuncKw wraps a keyword-aware Go function as a variadic builtin. Every call, with or without keywords, routes through kwfn; the positional-only path fills in empty keyword slices. Only the handful of builtins that take keyword arguments, such as the three-argument type(), need this.
func NewFuncKwT ¶
func NewFuncKwT(name string, kwfnT func(t *Thread, pos []Object, kwNames []string, kwVals []Object) (Object, error)) Object
NewFuncKwT wraps a keyword-aware Go function that also takes the ambient Thread, for the rare builtin that needs both keywords and the calling goroutine, such as asyncio.run binding its event loop to that thread. The t-less paths route the main thread in, so a single-threaded program reads the same value.
func NewFuncT ¶
NewFuncT wraps a Go function that takes the ambient Thread as a hidden first argument, the entry the thread-identity builtins use so get_ident and current_thread read the goroutine actually running rather than the main thread. A negative arity disables the positional argument count check.
func NewFunction ¶
func NewFunction(qual string, params []Param, defaults []Object, impl func(args []Object) (Object, error)) Object
NewFunction builds a function object. defaults must be nil or aligned one to one with params. It carries the thread-state-less impl the native module functions use; a compiled Python def uses NewFunctionT instead so the current Thread threads into its body.
func NewFunctionT ¶
func NewFunctionT(qual string, params []Param, defaults []Object, implT func(t *Thread, args []Object) (Object, error)) Object
NewFunctionT builds a function object whose body takes the current Thread as a hidden first argument. Every compiled Python def is wrapped this way, so a dynamic call through Call threads the caller's Thread into the body and thread-identity lookups inside it see the goroutine actually running.
func NewGenerator ¶
NewGenerator wraps a lowered generator body as a generator object. qual is the function's __qualname__, used only for repr.
func NewGeneratorAt ¶
NewGeneratorAt wraps a boxed twin body that resumes a deopted static generator mid-stream. seed is the discriminant the static machine last passed, and body switches on it at entry to jump to the yield boundary after it, with the saved fields already bound as boxed locals in the closure. This is the frame the static generator's deopt edge materializes: the static machine runs the guard-free prefix, and on a guard failure it constructs one of these seeded at the current state so the boxed twin yields the tail of the sequence CPython would. A seed of 0 resumes at the top, the same as a fresh generator.
func NewGenericAlias ¶
NewGenericAlias builds origin[item]. A tuple item spreads into the argument list, so list[int] carries one argument and dict[str, int] carries two; any other item is a single argument. This matches types.GenericAlias, which normalizes its second argument to a tuple for __args__.
func NewHashByName ¶
NewHashByName builds a HASH object for a named algorithm, optionally seeded with data. An unknown name is the ValueError hashlib.new and the openssl_* constructors surface.
func NewHmac ¶
NewHmac builds an HMAC object over a named algorithm, key and optional message. A shake or unknown algorithm is the UnsupportedDigestmodError caller hmac_new turns the miss into; here it is a plain ValueError the runtime maps.
func NewIntFromBig ¶
NewIntFromBig boxes a big.Int, normalizing back to the small form when the value fits. It takes ownership of b.
func NewIntText ¶
NewIntText boxes a decimal literal that may exceed int64. The lexer normalizes every integer literal to plain decimal, so a parse failure here is a compiler bug, not user input.
func NewInterpolation ¶
NewInterpolation builds one t-string field. formatSpec is a str object, since a spec with a nested field is evaluated at runtime rather than fixed.
func NewLRUCache ¶
NewLRUCache wraps fn in an lru_cache. maxsize is -1 for unbounded, 0 for disabled, or a positive bound; typed keys arguments by type so 3 and 3.0 do not share an entry.
func NewLocal ¶
func NewLocal() Object
NewLocal builds a fresh threading.local with no per-thread state yet. The first attribute a thread stores creates that thread's private dict.
func NewMappingProxy ¶
NewMappingProxy wraps a mapping in a read-only proxy. CPython accepts a dict or another mapping and rejects a list or any non-mapping with a TypeError naming the offending type; the floor only ever proxies a dict, so that is the mapping this recognizes, unwrapping a proxy of a proxy to the same dict.
func NewMemoryView ¶
NewMemoryView builds a memoryview over a bytes-like object. bytes yields a read-only view, bytearray a writable one, and a memoryview re-views the same root buffer over the same span. Anything else is the probed 3.14 TypeError.
func NewMethod ¶
NewMethod wraps a Go function as an instance method for a class dict built by NewClass. Read off an instance it binds the instance as self, the way a def-statement method does, so a Go-built classObject (such as _io._IOBase) can carry Python-visible methods. A plain NewFunc in a class dict comes back unbound; this is the self-binding variant. The first argument is self, so a method of n Python parameters takes arity n+1; a negative arity disables the count check for methods with defaults or varargs.
func NewMethodKw ¶
func NewMethodKw(name string, kwfn func(pos []Object, kwNames []string, kwVals []Object) (Object, error)) Object
NewMethodKw is the keyword-aware self-binding method, for a Go-built class method that takes keyword arguments, such as StringIO's __init__(initial_value, newline). kwfn receives self as the first positional argument alongside the keyword names and values; the positional-only fast path routes through it too.
func NewNamedTupleType ¶
NewNamedTupleType builds a namedtuple class from a validated name and field list. defaults aligns to the rightmost fields, so len(defaults) values apply to the last len(defaults) fields, matching namedtuple's defaults keyword.
func NewOrderedDict ¶
OrderedDict is a dict subclass from CPython's collections. A plain dict has preserved insertion order since 3.7, so the ordering itself is free here, and OrderedDict earns its keep through the order-aware extras: move_to_end, a popitem that can pop either end, order-sensitive equality against another OrderedDict, and reversed iteration. Like the other collections subclasses it is modeled as a dictObject with a kind, orderedDict, so it shares the dict storage, methods, and hashing.
func NewParamSpecArgsConstructor ¶
func NewParamSpecArgsConstructor() Object
NewParamSpecArgsConstructor and NewParamSpecKwargsConstructor return the callables bound as _typing.ParamSpecArgs / _typing.ParamSpecKwargs, which wrap a ParamSpec into its positional or keyword member.
func NewParamSpecConstructor ¶
func NewParamSpecConstructor() Object
NewParamSpecConstructor returns the callable bound as _typing.ParamSpec.
func NewParamSpecKwargsConstructor ¶
func NewParamSpecKwargsConstructor() Object
func NewPartial ¶
NewPartial builds a functools.partial over fn with the given frozen arguments, the body of _functools.partial's constructor. It rejects a non-callable func, a trailing Placeholder, and a Placeholder passed as a keyword the way CPython does, and folds a partial-of-a-partial into a single partial over the innermost callable, merging the frozen arguments (holes included) and letting the outer keywords override the inner ones.
func NewPattern ¶
func NewPattern(pattern Object, flags uint32, code []uint32, groups int, groupindex, indexgroup Object, isbytes bool) Object
NewPattern builds a compiled pattern from the pieces _sre.compile receives: the source pattern object, the flag bits, the decoded bytecode, the group count, and the two group-name maps. isbytes records whether the pattern was compiled from bytes, which the matcher checks against its subject.
func NewPlaceholder ¶
func NewPlaceholder() Object
NewPlaceholder returns the Placeholder singleton, the body of the _PlaceholderType constructor _functools exposes: the type is a singleton, so every call hands back the same instance.
func NewPrinter ¶
NewPrinter builds a copyright/credits/license singleton.
func NewProperty ¶
func NewQuitter ¶
NewQuitter builds the exit or quit singleton with the given name, which its repr echoes.
func NewRangeBig ¶
NewRangeBig builds a range from arbitrary-precision bounds. Each bound that fits int64 lands in the fast field, so a range of small numbers built this way is indistinguishable from NewRange; only the genuinely huge bounds spill into the big fields. The caller must reject a zero step.
func NewReTemplate ¶
NewReTemplate builds the compiled template _sre.template returns from the literal-and-index list _parser.parse_template produced.
func NewSet ¶
NewSet builds a set from elements, deduplicating on the canonical key and keeping first-insertion order.
func NewSimpleNamespace ¶
NewSimpleNamespace builds a namespace whose attributes are the given name and value pairs, in order. It is the Go-side constructor sys.implementation and any other native builder uses; the Python types.SimpleNamespace(...) call routes through newSimpleNamespace.
func NewSingleDispatch ¶
NewSingleDispatch wraps fn as the default implementation of a fresh single-dispatch generic function, carrying fn's name so it reprs the same.
func NewSlice ¶
NewSlice builds a slice value. The parts are stored verbatim; None stands for an omitted component, exactly the way CPython keeps it.
func NewStaticMethod ¶
NewStaticMethod, NewClassMethod, and NewProperty build the descriptor objects. The lowering reaches them through the builtin singletons below when staticmethod, classmethod, or property is used as a decorator or called directly.
func NewStringIO ¶
NewStringIO builds an io.StringIO over the initial value.
func NewSuper ¶
NewSuper builds the bound super for super(start, obj). start must be a class. obj is either an instance whose type has start in its MRO, the ordinary form, or a class that has start in its MRO, the super(type, subtype) form a classmethod (and __init_subclass__) uses. objCls is the linearization the cooperative walk follows: the instance's type in the first case, the subtype itself in the second. The unbound one-argument form is still a later slice.
func NewSuperUnbound ¶
NewSuperUnbound builds the one-argument unbound super, super(start). It carries no instance or instance-class, so it resolves no cooperative names until a __get__ binds it to an instance. This is the descriptor form CPython hands back from super(type) with a single argument.
func NewTemplate ¶
NewTemplate builds a Template from the static string parts and the interpolations between them.
func NewThreadObject ¶
func NewThreadObject(target Object, args []Object, kwNames []string, kwVals []Object, name string, nameGiven, daemon bool) Object
NewThreadObject builds a threading.Thread. name is used verbatim when nameGiven is set; otherwise the default "Thread-N (target)" name is assigned. The runtime resolves the daemon default (inherit from the current thread) before calling, so daemon is already the effective flag.
func NewTupleGetter ¶
NewTupleGetter builds a _tuplegetter descriptor for field index with the given doc string, the constructor the vendored collections package imports from _collections to install each namedtuple field. It is the seam the pure-Python namedtuple uses in place of the Go-native path's own getters.
func NewType3 ¶
NewType3 builds a class from the three-argument type(name, bases, namespace) form: the dynamic-class path type.__new__ runs. It validates the argument types with the probed type.__new__ wording, unpacks the namespace dict into the ordered name/value pairs a class body would produce, and hands the rest to NewClass so C3 linearization, __set_name__ and __init_subclass__ fire the same way a class statement would. A namespace __module__ sets the qualified name so repr reads <class 'module.Name'>, defaulting to __main__ like CPython.
func NewType3Kw ¶
NewType3Kw builds a class from the four-argument type(name, bases, namespace, **kwds) form. It derives the winning metaclass from the bases the way type.__new__ does, so a base carrying a metaclass such as EnumType drives creation through that metaclass, and forwards the class keywords to it and to __init_subclass__. With no metaclass among the bases the winner is the default type metatype and the keywords reach __init_subclass__. This is the shape enum's convert_class runs: type(name, (StrEnum,), body, boundary=..., _simple=True).
func NewTypeAlias ¶
NewTypeAlias binds the alias name to a lazily evaluated value. compute is a zero-argument callable returning the evaluated right-hand side; it does not run until __value__ is read.
func NewTypeAliasTypeConstructor ¶
func NewTypeAliasTypeConstructor() Object
NewTypeAliasTypeConstructor builds the _typing.TypeAliasType constructor. TypeAliasType(name, value, *, type_params=()) creates an alias eagerly: name is required and must be str, value is required, and type_params must be a tuple. It is what typing.py re-exports as TypeAliasType for the PEP 695 API.
func NewTypeVarConstructor ¶
func NewTypeVarConstructor() Object
NewTypeVarConstructor returns the callable bound as _typing.TypeVar. It is a keyword-aware, thread-threaded function so it can read the constraints as varargs, the options as keywords, and the caller's module for __module__.
func NewTypeVarTupleConstructor ¶
func NewTypeVarTupleConstructor() Object
NewTypeVarTupleConstructor returns the callable bound as _typing.TypeVarTuple.
func NewWeakref ¶
NewWeakref builds ref(obj) or ref(obj, callback). It rejects a referent whose type carries no weak reference support with the TypeError CPython raises, so WeakSet.__contains__ can lean on the try/except around ref(item) the way it does for a value that cannot be weakly referenced.
func NewZlibCompress ¶
NewZlibCompress builds a Compress object writing the framing wbits selects at the given level: 9..15 is zlib framing, the negative range is raw DEFLATE, and 25..31 is gzip. An unsupported wbits is the ValueError compressobj raises.
func NewZlibDecompress ¶
NewZlibDecompress builds a Decompress object reading the framing wbits selects, mirroring the one-shot decompress: the positive range is zlib framing, the negative range is raw DEFLATE, and the high ranges are gzip and autodetect.
func NewZlibDecompressor ¶
NewZlibDecompressor builds the private _ZlibDecompressor GzipFile reads through. It shares the Decompress machinery but exposes needs_input and no flush, matching the C class DecompressReader drives one member at a time.
func NextValue ¶
NextValue implements the next() builtin: next(it) or next(it, default). The argument must already be an iterator, the type CPython insists on; a list or other iterable is not one until iter() wraps it. Exhaustion raises StopIteration, or returns the default when one is given, and a generator's return value rides the raised StopIteration.
func NoDefaultSingleton ¶
func NoDefaultSingleton() Object
NoDefaultSingleton returns the shared typing.NoDefault sentinel so the _typing module can bind it and type-parameter objects can point __default__ at it.
func ObjectType ¶
func ObjectType() Object
ObjectType is the object builtin, the root type every class derives from. It is the same singleton the MRO, __bases__, and isinstance/issubclass roots already resolve to, so the runtime can register it as the `object` name and object() constructs a bare instance through the ordinary class-call path.
func PickleErrorClass ¶
func PickleErrorClass() Object
PickleErrorClass returns pickle.PickleError, the base of the pickle exceptions.
func PickleLoads ¶
PickleLoads parses a pickle and returns the top object.
func PicklingErrorClass ¶
func PicklingErrorClass() Object
PicklingErrorClass returns pickle.PicklingError, raised when an object cannot be pickled.
func Pow ¶
Pow implements the ** operator. A negative exponent gives a float, and an int result past int64 spills to big. Probed 3.14 wordings: 0 ** -1 and 0.0 ** -1 both say "zero to a negative power", and a float result past the double range is errno-flavored OverflowError.
func PowDunder ¶
PowDunder runs the ternary pow(base, exp, mod) slot protocol for a triple the integers-only Pow3 fast path declined, calling base.__pow__(exp, mod) and exp.__rpow__(base, mod). It mirrors binaryDunder with the modulus threaded into every call: the reflected slot is nulled when it duplicates the left slot, and it runs reflected-first when exp's class is a proper subclass of base's. ok is false when neither base nor exp is a user instance defining its slot, or both return NotImplemented, leaving Pow3's own error.
func QueueEmptyClass ¶
func QueueEmptyClass() Object
QueueEmptyClass returns the queue.Empty class object, spelled _queue.Empty the way CPython reports it.
func QueueFullClass ¶
func QueueFullClass() Object
QueueFullClass returns the queue.Full class object.
func QueueShutDownClass ¶
func QueueShutDownClass() Object
QueueShutDownClass returns the queue.ShutDown class object, raised by put and get once the queue has been shut down. CPython added it in 3.13 and keeps it in queue.py, so its qualified name is queue.ShutDown.
func RShift ¶
RShift implements the >> operator with arithmetic (sign-filling) shift, which matches Python's floor semantics for negative ints. A shift count past int64 leaves only the sign: 0 or -1.
func ReplaceErrors ¶
ReplaceErrors is the "replace" handler: '?' per character on encode, one U+FFFD on decode, and U+FFFD per character on translate.
func RoundFloat ¶
RoundFloat rounds a float to nd decimal digits through exact decimal arithmetic on big.Rat, not math.Round, so round(2.675, 2) is 2.67 exactly as CPython's dtoa-based rounding gives. It is the ndigits form, which stays a float where the no-ndigits form returns an int.
func RoundFloatToInt ¶
RoundFloatToInt rounds a float to the nearest integer, half to even, the no-ndigits form round(x) and (x).__round__() take. An infinite or nan value cannot become an integer, matching CPython's int-conversion errors.
func RunCoroutineThreadsafe ¶
RunCoroutineThreadsafe implements asyncio.run_coroutine_threadsafe(coro, loop). It submits coro to a loop that is (or will be) running on another thread and hands back a concurrent.futures.Future the calling thread blocks on with .result(). The coroutine is not a task yet: task creation touches loop state owned by the loop goroutine, so the wrapping is scheduled with call_soon and runs there. When the task finishes the loop copies its outcome, a value, an exception, or a task-side cancellation, onto the concurrent future, which wakes the waiting thread.
The chaining is forward only: the returned future mirrors the task. Cancelling the returned future to cancel the coroutine, the reverse edge CPython also wires, is a later slice; nothing here needs it and leaving it out keeps the concurrent future's callback list to real Python callables.
func SeqItem ¶
SeqItem returns o[i] for a sequence subject by Go index. The caller has already checked the length, so i is in range and no IndexError arises.
func SliceOf ¶
SliceOf implements the slice() builtin. One argument is the stop bound with start and step defaulting to None; two fill start and stop; three fill all. Zero or more than three is the arity TypeError CPython gives, spelled against "slice" and kept catchable.
func StarArgsFor ¶
StarArgsFor converts a lone *iterable for a callee whose spelling is known at compile time, like an exception class. The funcstr arrives pre-rendered because no callee object exists to derive it from.
func StrDecode ¶
StrDecode implements the decoding form of the str constructor, str(object, encoding='utf-8', errors='strict'). A str object cannot be decoded, and a non-bytes-like object is rejected the way CPython's PyUnicode_FromEncodedObject does. The encoding and errors arguments carry str()'s own wording, distinct from bytes.decode's.
func Sub ¶
Sub implements the - operator. On set operands it is set difference, with the result type following the left operand.
func SurrogateEscapeErrors ¶
SurrogateEscapeErrors is the "surrogateescape" handler (PEP 383). On encode it maps each low surrogate U+DC80..U+DCFF in the bad span back to its single byte and returns the bytes; a character outside that range cannot be escaped, so it re-raises the original error. On decode it maps each non-ASCII byte in the bad span to a low surrogate U+DC00+byte and returns the str; an ASCII byte cannot be the target of an escape, so it re-raises. It is codec-agnostic, the same byte<->surrogate rule for every codec, so it reads the bad span straight off the structured error and any codec loop that calls the registered handler (the charmap and multibyte codecs) gets it.
func SurrogatePassErrors ¶
SurrogatePassErrors is the "surrogatepass" handler. Unlike the other handlers it is codec-specific: it reads the byte order and unit width off the error's encoding attribute (the utf-8, utf-16 and utf-32 families, a bare utf-16/utf-32 taking the host order) and passes a surrogate code point through as that codec's raw bytes. On encode each surrogate U+D800..U+DFFF in the bad span is emitted as its raw unit; a non-surrogate cannot be passed, so the original error re-raises. On decode it reads one unit at the bad position, and if it is a surrogate returns that code point and resumes past the unit; a truncated or malformed unit, or a non-surrogate, re-raises. An encoding outside the utf families re-raises, since surrogatepass only knows those codecs' byte forms.
func TotalOrdering ¶
TotalOrdering is functools.total_ordering: given a class that defines __eq__ and at least one ordering operation, it fills in the rest from the one it prefers (< over <= over > over >=). Each synthesized method calls the root operation and, unless that returns NotImplemented, combines the result with an equality check exactly as CPython's functools does. A class with no ordering operation is the ValueError CPython raises.
func TrueDiv ¶
TrueDiv implements the / operator. The result is always a float. Two big ints divide exactly through big.Rat, matching CPython's correctly rounded int/int quotient past the float64 range.
func TypeSingleton ¶
TypeSingleton returns the cached type value for a kind that has no constructor, creating it on first use. Callers pass the CPython type name (NoneType, ellipsis, function, builtin_function_or_method, ...).
func UnionForm ¶
func UnionForm() Object
UnionForm is the typing.Union special form, the object _typing exports as Union and the type of every X | Y value, so `type(int | str) is Union` holds. Subscripting it builds a union the same way the | operator does.
func UnpackEx ¶
UnpackEx destructures an iterable around a starred target: before fixed leading values, one list soaking up the middle, then after fixed trailing values. The result has before+1+after entries with the list at index before.
func UnpicklingErrorClass ¶
func UnpicklingErrorClass() Object
UnpicklingErrorClass returns pickle.UnpicklingError, raised when a pickle stream is malformed or cannot be reconstructed.
func UnwrapPartial ¶
UnwrapPartial peels a functools.partial chain down to the innermost wrapped callable, following .func while the value is a partial, the way functools' _unwrap_partial helper does. A value that is not a partial comes back unchanged.
func UpdateWrapper ¶
UpdateWrapper copies each attribute named in assigned from wrapped onto wrapper, merges each dict named in updated, and sets wrapper.__wrapped__ to wrapped, returning wrapper. A wrapped object that lacks an assigned attribute is skipped and a missing updated dict contributes nothing, the getattr with default and setattr shape CPython's update_wrapper performs. assigned and updated are iterables of attribute names, so a caller can override the defaults the way functools does.
func UserMetaOf ¶
UserMetaOf returns the user metaclass of a class value so type() can report it. ok is false for a class on the default `type` metatype, which the runtime spells with the `type` builtin, and for every non-class object.
func Wait ¶
Wait implements concurrent.futures.wait(fs, timeout, return_when). It returns the DoneAndNotDoneFutures namedtuple of the done and not-done sets once the return condition is met or the timeout elapses. return_when is validated only when at least one future is still pending, matching CPython, which reaches the check inside _create_and_install_waiters only after the all-done short circuit; so wait over an all-done group never rejects an invalid condition. The value arrives as an object because CPython compares it by equality to the constant strings and reports it with %r on a miss, which prints a non-string as itself.
func WithFuncAnnotationsLazy ¶
WithFuncAnnotationsLazy records a def's parameter and return annotations as unevaluated closures on a freshly built function object, in declaration order with the names aligned to the thunks, and returns the function so the emit site can wrap the NewFunction call. They realize on the first __annotations__ read.
func WithFuncDoc ¶
WithFuncDoc sets a function's initial __doc__ from its docstring, the leading bare string literal in the def body, and returns the function so a def or method emit site can wrap the freshly built object. It is the ordinary __doc__ value, so a later assignment overrides it and a del reverts it to None, the same shape CPython gives a function that carries a docstring.
func WithFuncFirstLine ¶
WithFuncFirstLine records a function's def source line so its __code__ reports it as co_firstlineno, and returns the function so a def or method emit site can wrap the freshly built object the way WithFuncDoc does. It is set once at definition and not a writable slot, matching CPython, where co_firstlineno is a read-only code attribute.
func WithFuncModule ¶
WithFuncModule records the module a def belongs to so its __module__ reads back the defining module's __name__, and returns the function so a def, method or lambda emit site can wrap the freshly built object the way WithFuncDoc does. A def in the main module leaves the slot at its __main__ default; a def in an imported or vendored module carries that module's name, which is what test.support.check__all__ compares against to decide a name is part of the module's public API. It is an ordinary writable slot, so a later assignment overrides it, matching CPython where a function's __module__ is settable.
func WithFuncModuleObj ¶
WithFuncModuleObj is the variant used when the defining module reassigned __name__ (as _pydecimal does for pickling): the def's __module__ takes the live __name__ value the compiler's `__module__ = __name__` would read rather than the compile-time module name. A nil value (a __name__ that was deleted) leaves the slot at its __main__ default the way an unset slot reads.
func XMLCharRefReplaceErrors ¶
XMLCharRefReplaceErrors is the "xmlcharrefreplace" handler: replace each unencodable character with its decimal numeric character reference. Encode only.
type Param ¶
Param is one formal parameter of a function object. Whether it carries a default lives in the aligned defaults slice, not here, because the default value is only known when the def or lambda executes.
type ParamKind ¶
type ParamKind int
ParamKind classifies one formal parameter, mirroring the frontend split.
type StructSeqType ¶
type StructSeqType struct {
// contains filtered or unexported fields
}
StructSeqType is a C structseq class, the tuple subclass os.stat_result and the other os result types use. It differs from a namedtuple in two ways a namedType cannot express: it carries named fields that are NOT part of the sequence (st_atime_ns, st_blksize, ...), and a named field can hold a value different from the tuple slot at the same index (st[7] is the int seconds, st.st_atime is the float). The type keeps the field metadata; each instance is a tupleObject whose elts are the visible sequence and whose sseq binding holds the full named-value vector.
func NewStructSeqType ¶
func NewStructSeqType(name, reprName string, fields []string, nSeq, nUnnamed int) *StructSeqType
NewStructSeqType builds a structseq class. fields lists every named field in repr order; nSeq is how many entries the sequence exposes; nUnnamed is the structseq n_unnamed_fields count. It is small and immutable, shared by every instance.
func (*StructSeqType) NewStructSeq ¶
func (t *StructSeqType) NewStructSeq(seq, named []Object) Object
NewStructSeq builds one instance. seq is the visible sequence (len nSeq) and named is the full named-value vector (len len(fields)). The two overlap for the first fields but may differ where a slot carries a different attribute form, as the stat time fields do.
func (*StructSeqType) TypeName ¶
func (*StructSeqType) TypeName() string
type Thread ¶
type Thread struct {
// contains filtered or unexported fields
}
Thread is unagi's per-goroutine execution state, the value spec 2076 doc 10 §2.1 threads through every compiled function as a hidden first parameter, exactly the way CPython threads tstate through its C internals. Go exposes no goroutine-local storage on purpose, so the state is carried explicitly rather than looked up.
The struct lives in pkg/objects, not pkg/runtime where the spec files it, because the callable ABI (Call, CallKw, functionObject.bind) is in this package and must name the type to pass it to a compiled function, and pkg/objects sits below pkg/runtime. pkg/runtime aliases it as runtime.Thread and grows the registry, spawn wrapper, and threading-module surface on top.
Every field is owned by one goroutine at a time. The identity fields (ident, name, daemon) are set before the thread is published to a second goroutine and only read afterward, so they need no synchronization; the ident allocator is the one shared piece and is atomic.
func NewThread ¶
NewThread builds a fresh thread state with a new ident. The caller sets it running through the runtime spawn wrapper; the done channel closes when the target returns.
func (*Thread) Done ¶
func (t *Thread) Done() chan struct{}
Done returns the channel closed when the thread's target returns, the backing for Thread.join and Thread.is_alive.
func (*Thread) EnterRecursive ¶
EnterRecursive charges one Python frame against this thread's depth and returns a RecursionError once the new depth passes limit. A frame that trips the limit never really runs, so it takes its charge back before returning the error, keeping the counter balanced without a paired LeaveRecursive. Only the owning goroutine calls this, so the counter needs no lock.
func (*Thread) FrameAtDepth ¶
FrameAtDepth returns the frame depth levels above the running one, the value sys._getframe(depth) hands back: depth 0 is the caller of _getframe, 1 its caller, and so on. sys._getframe is a builtin and pushes no frame of its own, so depth 0 is genuinely the compiled function that called it. A depth past the bottom of the stack is the ValueError CPython raises, and a negative depth reads as 0 the way CPython clamps it. It returns Object rather than the unexported frame type so pkg/runtime can hand it straight back.
func (*Thread) LeaveRecursive ¶
func (t *Thread) LeaveRecursive()
LeaveRecursive releases one frame as it returns or unwinds, pairing with a successful EnterRecursive through a deferred call. It never drives the depth negative, so a stray unwind cannot let a later runaway recurse past the limit.
func (*Thread) PopFrame ¶
func (t *Thread) PopFrame()
PopFrame drops the running frame as its function returns or unwinds, paired with PushFrame through a deferred call. It never underflows, so a stray unwind cannot corrupt the stack.
func (*Thread) PushFrame ¶
func (t *Thread) PushFrame(f *frameObject)
PushFrame links a frame under the current top and makes it the running frame, called from compiled code on function entry. The link is set here rather than by the caller so f_back always mirrors the live stack.
func (*Thread) SetLine ¶
SetLine records the line the running frame is executing, called from compiled code as each statement begins so f_lineno on the frame sys._getframe walks tracks the live line the way CPython updates it per line. A thread with no running frame drops the update rather than crash.
func (*Thread) SetName ¶
SetName renames the thread; only the owning thread and the constructor call it.
func (*Thread) SetWrapper ¶
SetWrapper records the owning threading.Thread. start() calls it before the goroutine runs; the main thread is wired at package init.
Source Files
¶
- annotations.go
- array.go
- arraysubclass.go
- asyncfor.go
- asyncgen.go
- asyncio.go
- asyncio_ascompleted.go
- asyncio_barrier.go
- asyncio_condition.go
- asyncio_event.go
- asyncio_exchandler.go
- asyncio_executor.go
- asyncio_futureobj.go
- asyncio_handle.go
- asyncio_lock.go
- asyncio_predicates.go
- asyncio_queue.go
- asyncio_runner.go
- asyncio_semaphore.go
- asyncio_socket.go
- asyncio_streamreader.go
- asyncio_streamwriter.go
- asyncio_taskgroup.go
- asyncio_threadsafe.go
- asyncio_timeout.go
- attrhooks.go
- barrier.go
- binop.go
- builtinbase.go
- builtinmethodnames.go
- builtinstatics.go
- bytearray.go
- bytes.go
- bytesdecode.go
- bytesdunders.go
- bytesmethods.go
- bytessplit.go
- bytestransform.go
- bz2codec.go
- cachedprop.go
- callex.go
- chainmap.go
- class.go
- cmpkey.go
- codecregistry.go
- complex.go
- cond.go
- container.go
- contextvars.go
- counter.go
- csv.go
- defaultdict.go
- deque.go
- descriptors.go
- dict.go
- dictmethods.go
- dir_value.go
- event.go
- excclass.go
- excgroup.go
- excstack.go
- excstar.go
- exctypes.go
- executor.go
- fileio.go
- floatmethods.go
- format.go
- frame.go
- funcattrs.go
- function.go
- futures.go
- futureswait.go
- generator.go
- genericalias.go
- hash.go
- hashlib.go
- inplace.go
- int.go
- intbytes.go
- intmethods.go
- listmethods.go
- listsubclass.go
- lock.go
- lrucache.go
- mappingproxy.go
- marshal.go
- match.go
- memoryview.go
- memoryviewdunders.go
- metaclass.go
- methods.go
- module.go
- mrodescriptor.go
- namedtuple.go
- namespace.go
- numericdunders.go
- objects.go
- ops.go
- ordereddict.go
- oserror.go
- partial.go
- percent.go
- percentbytes.go
- pickle.go
- picklebuiltin.go
- picklecompat.go
- picklecontainer.go
- pickleexc.go
- pickleglobal.go
- pickleinstance.go
- pickleload.go
- picklereduce.go
- prepare.go
- queue.go
- rematch.go
- repr.go
- resub.go
- richcmp.go
- round.go
- scalar_compare.go
- scalarunbounddunders.go
- semaphore.go
- set.go
- setsubclass.go
- simplequeue.go
- singledispatch.go
- site.go
- slice.go
- sliceval.go
- slots.go
- specialattr.go
- sre.go
- strdunders.go
- strmethods.go
- structseq.go
- super.go
- surrogate.go
- template.go
- thread.go
- threadlocal.go
- threadobj.go
- totalordering.go
- traceback.go
- tuplemethods.go
- typealias.go
- typing.go
- unicodeerror.go
- union.go
- updatewrapper.go
- weakref.go
- with.go
- zlibcodec.go