diff options
author | Oleg Iarygin <oleg@arhadthedev.net> | 2022-07-20 20:24:51 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-20 20:24:51 (GMT) |
commit | 41e0585ffabfcd227718a247a02285ea590ed51e (patch) | |
tree | 0829cb1f34124699dc19bbd4cddd571ee5869c89 /Python/_warnings.c | |
parent | 6dadf6ca019f2e19ca8f0344903be0c539263c30 (diff) | |
download | cpython-41e0585ffabfcd227718a247a02285ea590ed51e.zip cpython-41e0585ffabfcd227718a247a02285ea590ed51e.tar.gz cpython-41e0585ffabfcd227718a247a02285ea590ed51e.tar.bz2 |
gh-91102: Port 8-argument _warnings.warn_explicit to Argument Clinic (#92891)
Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r-- | Python/_warnings.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index 601dae8..1b9e107 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -1030,28 +1030,31 @@ get_source_line(PyInterpreterState *interp, PyObject *module_globals, int lineno return source_line; } +/*[clinic input] +warn_explicit as warnings_warn_explicit + + message: object + category: object + filename: unicode + lineno: int + module as mod: object = NULL + registry: object = None + module_globals: object = None + source as sourceobj: object = None + +Issue a warning, or maybe ignore it or raise an exception. +[clinic start generated code]*/ + static PyObject * -warnings_warn_explicit(PyObject *self, PyObject *args, PyObject *kwds) +warnings_warn_explicit_impl(PyObject *module, PyObject *message, + PyObject *category, PyObject *filename, + int lineno, PyObject *mod, PyObject *registry, + PyObject *module_globals, PyObject *sourceobj) +/*[clinic end generated code: output=c49c62b15a49a186 input=df6eeb8b45e712f1]*/ { - static char *kwd_list[] = {"message", "category", "filename", "lineno", - "module", "registry", "module_globals", - "source", 0}; - PyObject *message; - PyObject *category; - PyObject *filename; - int lineno; - PyObject *module = NULL; - PyObject *registry = NULL; - PyObject *module_globals = NULL; - PyObject *sourceobj = NULL; PyObject *source_line = NULL; PyObject *returned; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOUi|OOOO:warn_explicit", - kwd_list, &message, &category, &filename, &lineno, &module, - ®istry, &module_globals, &sourceobj)) - return NULL; - PyThreadState *tstate = get_current_tstate(); if (tstate == NULL) { return NULL; @@ -1070,8 +1073,8 @@ warnings_warn_explicit(PyObject *self, PyObject *args, PyObject *kwds) return NULL; } } - returned = warn_explicit(tstate, category, message, filename, lineno, module, - registry, source_line, sourceobj); + returned = warn_explicit(tstate, category, message, filename, lineno, + mod, registry, source_line, sourceobj); Py_XDECREF(source_line); return returned; } @@ -1331,13 +1334,9 @@ _PyErr_WarnUnawaitedCoroutine(PyObject *coro) } } -PyDoc_STRVAR(warn_explicit_doc, -"Low-level interface to warnings functionality."); - static PyMethodDef warnings_functions[] = { WARNINGS_WARN_METHODDEF - {"warn_explicit", _PyCFunction_CAST(warnings_warn_explicit), - METH_VARARGS | METH_KEYWORDS, warn_explicit_doc}, + WARNINGS_WARN_EXPLICIT_METHODDEF {"_filters_mutated", _PyCFunction_CAST(warnings_filters_mutated), METH_NOARGS, NULL}, /* XXX(brett.cannon): add showwarning? */ |