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 ¶
- func FilterWarnings(action string, category *objects.Type, module string, lineno int64)
- func FiltersList() *objects.List
- func ResetFilters()
- func ResourceWarning(source objects.Object, stackLevel int64, format string, a ...interface{}) error
- func SimpleFilter(action string)
- func Warn(category *objects.Type, text string) error
- func WarnEx(category *objects.Type, text string, stackLevel int64) error
- func WarnExplicit(category *objects.Type, text, filenameStr string, lineno int64, ...) error
- func WarnExplicitFormat(category *objects.Type, filenameStr string, lineno int64, moduleStr string, ...) error
- func WarnExplicitObject(category *objects.Type, message, filename objects.Object, lineno int64, ...) error
- func WarnFormat(category *objects.Type, stackLevel int64, format string, a ...interface{}) error
- func WarnFormatSource(source objects.Object, category *objects.Type, stackLevel int64, format string, ...) error
- func WarnUnawaitedAgenMethod(agen objects.Object, method objects.Object)
- func WarnUnawaitedCoroutine(coro objects.Object)
- func WarnUnicode(category *objects.Type, message string, stackLevel int64, ...) error
- func WarningsFini()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterWarnings ¶
FilterWarnings prepends an (action, message, category, module, lineno) row to the filter list. Mirrors warnings.filterwarnings.
func FiltersList ¶
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 ¶
Warn ports the legacy PyErr_Warn (stack_level==1).
CPython: Python/_warnings.c:1452 PyErr_Warn
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 ¶
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 ¶
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 ¶
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.