#include "Python.h"
#include "pycore_critical_section.h"
#include "pycore_interp.h"
#include "pycore_long.h"
#include "pycore_pyerrors.h"
#include "pycore_pylifecycle.h"
#include "pycore_pystate.h"
#include "pycore_sysmodule.h"
#include "pycore_traceback.h"
#include <stdbool.h>
#include "clinic/_warnings.c.h"
#define MODULE_NAME …
PyDoc_STRVAR(warnings__doc__,
MODULE_NAME " provides basic warning filtering support.\n"
"It is a helper module to speed up interpreter start-up.");
WarningsState;
static inline int
check_interp(PyInterpreterState *interp)
{ … }
static inline PyInterpreterState *
get_current_interp(void)
{ … }
static inline PyThreadState *
get_current_tstate(void)
{ … }
static WarningsState *
warnings_get_state(PyInterpreterState *interp)
{ … }
static void
warnings_clear_state(WarningsState *st)
{ … }
#ifndef Py_DEBUG
static PyObject *
create_filter(PyObject *category, PyObject *action_str, const char *modname)
{ … }
#endif
static PyObject *
init_filters(PyInterpreterState *interp)
{ … }
int
_PyWarnings_InitState(PyInterpreterState *interp)
{ … }
static int
check_matched(PyInterpreterState *interp, PyObject *obj, PyObject *arg)
{ … }
#define GET_WARNINGS_ATTR(interp, ATTR, try_import) …
static PyObject *
get_warnings_attr(PyInterpreterState *interp, PyObject *attr, int try_import)
{ … }
static PyObject *
get_once_registry(PyInterpreterState *interp)
{ … }
static PyObject *
get_default_action(PyInterpreterState *interp)
{ … }
static PyObject*
get_filter(PyInterpreterState *interp, PyObject *category,
PyObject *text, Py_ssize_t lineno,
PyObject *module, PyObject **item)
{ … }
static int
already_warned(PyInterpreterState *interp, PyObject *registry, PyObject *key,
int should_set)
{ … }
static PyObject *
normalize_module(PyObject *filename)
{ … }
static int
update_registry(PyInterpreterState *interp, PyObject *registry, PyObject *text,
PyObject *category, int add_zero)
{ … }
static void
show_warning(PyThreadState *tstate, PyObject *filename, int lineno,
PyObject *text, PyObject *category, PyObject *sourceline)
{ … }
static int
call_show_warning(PyThreadState *tstate, PyObject *category,
PyObject *text, PyObject *message,
PyObject *filename, int lineno, PyObject *lineno_obj,
PyObject *sourceline, PyObject *source)
{ … }
static PyObject *
warn_explicit(PyThreadState *tstate, PyObject *category, PyObject *message,
PyObject *filename, int lineno,
PyObject *module, PyObject *registry, PyObject *sourceline,
PyObject *source)
{ … }
static PyObject *
get_frame_filename(PyFrameObject *frame)
{ … }
static bool
is_internal_filename(PyObject *filename)
{ … }
static bool
is_filename_to_skip(PyObject *filename, PyTupleObject *skip_file_prefixes)
{ … }
static bool
is_internal_frame(PyFrameObject *frame)
{ … }
static PyFrameObject *
next_external_frame(PyFrameObject *frame, PyTupleObject *skip_file_prefixes)
{ … }
static int
setup_context(Py_ssize_t stack_level,
PyTupleObject *skip_file_prefixes,
PyObject **filename, int *lineno,
PyObject **module, PyObject **registry)
{ … }
static PyObject *
get_category(PyObject *message, PyObject *category)
{ … }
static PyObject *
do_warn(PyObject *message, PyObject *category, Py_ssize_t stack_level,
PyObject *source, PyTupleObject *skip_file_prefixes)
{ … }
static PyObject *
warnings_warn_impl(PyObject *module, PyObject *message, PyObject *category,
Py_ssize_t stacklevel, PyObject *source,
PyTupleObject *skip_file_prefixes)
{ … }
static PyObject *
get_source_line(PyInterpreterState *interp, PyObject *module_globals, int lineno)
{ … }
static PyObject *
warnings_warn_explicit_impl(PyObject *module, PyObject *message,
PyObject *category, PyObject *filename,
int lineno, PyObject *mod, PyObject *registry,
PyObject *module_globals, PyObject *sourceobj)
{ … }
static PyObject *
warnings_filters_mutated_impl(PyObject *module)
{ … }
static int
warn_unicode(PyObject *category, PyObject *message,
Py_ssize_t stack_level, PyObject *source)
{ … }
static int
_PyErr_WarnFormatV(PyObject *source,
PyObject *category, Py_ssize_t stack_level,
const char *format, va_list vargs)
{ … }
int
PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level,
const char *format, ...)
{ … }
static int
_PyErr_WarnFormat(PyObject *source, PyObject *category, Py_ssize_t stack_level,
const char *format, ...)
{ … }
int
PyErr_ResourceWarning(PyObject *source, Py_ssize_t stack_level,
const char *format, ...)
{ … }
int
PyErr_WarnEx(PyObject *category, const char *text, Py_ssize_t stack_level)
{ … }
#undef PyErr_Warn
int
PyErr_Warn(PyObject *category, const char *text)
{ … }
int
PyErr_WarnExplicitObject(PyObject *category, PyObject *message,
PyObject *filename, int lineno,
PyObject *module, PyObject *registry)
{ … }
int
PyErr_WarnExplicit(PyObject *category, const char *text,
const char *filename_str, int lineno,
const char *module_str, PyObject *registry)
{ … }
int
PyErr_WarnExplicitFormat(PyObject *category,
const char *filename_str, int lineno,
const char *module_str, PyObject *registry,
const char *format, ...)
{ … }
void
_PyErr_WarnUnawaitedAgenMethod(PyAsyncGenObject *agen, PyObject *method)
{ … }
void
_PyErr_WarnUnawaitedCoroutine(PyObject *coro)
{ … }
static PyMethodDef warnings_functions[] = …;
static int
warnings_module_exec(PyObject *module)
{ … }
static PyModuleDef_Slot warnings_slots[] = …;
static struct PyModuleDef warnings_module = …;
PyMODINIT_FUNC
_PyWarnings_Init(void)
{ … }
void
_PyWarnings_Fini(PyInterpreterState *interp)
{ … }