_warnings

package
v0.12.3 Latest Latest
Warning

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

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

Documentation

Overview

Package _warnings is the gopy port of CPython's _warnings C accelerator. It backs `import _warnings` plus the C-level PyErr_WarnEx / PyErr_WarnFormat / PyErr_WarnExplicit family that the rest of the runtime calls. The vendored Lib/warnings.py is the Python facade; this module supplies the fast filter / lock / registry plumbing underneath it.

CPython: Python/_warnings.c

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterWarnings

func FilterWarnings(action string, category *objects.Type, module string, lineno int64)

FilterWarnings prepends an (action, message, category, module, lineno) row to the filter list. Mirrors warnings.filterwarnings.

func FiltersList

func FiltersList() *objects.List

FiltersList exposes the live filter list for callers (tests, Lib/warnings.py overrides). Returning the same *List so mutations propagate to subsequent warn() calls.

func ResetFilters

func ResetFilters()

ResetFilters drops every row, the gopy equivalent of warnings.resetwarnings().

func ResourceWarning

func ResourceWarning(source objects.Object, stackLevel int64, format string, a ...interface{}) error

ResourceWarning ports PyErr_ResourceWarning.

CPython: Python/_warnings.c:1420 PyErr_ResourceWarning

func SimpleFilter

func SimpleFilter(action string)

SimpleFilter clears the filter list and inserts one row of the given action against every Warning. Mirrors the Python simplefilter() behavior at the C state level.

func Warn

func Warn(category *objects.Type, text string) error

Warn ports the legacy PyErr_Warn (stack_level==1).

CPython: Python/_warnings.c:1452 PyErr_Warn

func WarnEx

func WarnEx(category *objects.Type, text string, stackLevel int64) error

WarnEx ports PyErr_WarnEx.

CPython: Python/_warnings.c:1435 PyErr_WarnEx

func WarnExplicit

func WarnExplicit(category *objects.Type, text, filenameStr string, lineno int64, moduleStr string, registry objects.Object) error

WarnExplicit ports PyErr_WarnExplicit.

CPython: Python/_warnings.c:1482 PyErr_WarnExplicit

func WarnExplicitFormat

func WarnExplicitFormat(category *objects.Type, filenameStr string, lineno int64, moduleStr string, registry objects.Object, format string, a ...interface{}) error

WarnExplicitFormat ports PyErr_WarnExplicitFormat.

CPython: Python/_warnings.c:1514 PyErr_WarnExplicitFormat

func WarnExplicitObject

func WarnExplicitObject(category *objects.Type, message, filename objects.Object, lineno int64, module objects.Object, registry objects.Object) error

WarnExplicitObject ports PyErr_WarnExplicitObject.

CPython: Python/_warnings.c:1459 PyErr_WarnExplicitObject

func WarnFormat

func WarnFormat(category *objects.Type, stackLevel int64, format string, a ...interface{}) error

WarnFormat ports PyErr_WarnFormat: format args via fmt.Sprintf, then hand off to WarnUnicode.

CPython: Python/_warnings.c:1394 PyErr_WarnFormat

func WarnFormatSource

func WarnFormatSource(source objects.Object, category *objects.Type, stackLevel int64, format string, a ...interface{}) error

WarnFormatSource ports the static _PyErr_WarnFormat. Same as WarnFormat but threads a source object through to ResourceWarning finalization handlers.

CPython: Python/_warnings.c:1407 _PyErr_WarnFormat

func WarnUnawaitedAgenMethod

func WarnUnawaitedAgenMethod(agen objects.Object, method objects.Object)

WarnUnawaitedAgenMethod ports _PyErr_WarnUnawaitedAgenMethod. gopy does not yet ship async generators; the entry point is exposed so callers can wire it once Modules/_asyncio lands.

CPython: Python/_warnings.c:1558 _PyErr_WarnUnawaitedAgenMethod

func WarnUnawaitedCoroutine

func WarnUnawaitedCoroutine(coro objects.Object)

WarnUnawaitedCoroutine ports _PyErr_WarnUnawaitedCoroutine.

CPython: Python/_warnings.c:1573 _PyErr_WarnUnawaitedCoroutine

func WarnUnicode

func WarnUnicode(category *objects.Type, message string, stackLevel int64, source objects.Object) error

WarnUnicode is the workhorse used by PyErr_Warn*. Mirrors warn_unicode.

CPython: Python/_warnings.c:1360 warn_unicode

func WarningsFini

func WarningsFini()

WarningsFini drops every entry of the active state, mirroring _PyWarnings_Fini.

CPython: Python/_warnings.c:1687 _PyWarnings_Fini

Types

This section is empty.

Jump to

Keyboard shortcuts

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