Debian Codegraph @

pypy/module/cpyext/src/_warnings.c

raw symbols SCIP
1 #include <Python.h>
2
3 int
4 PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level,
5 const char *format, ...)
6 {
7 int ret;
8 PyObject *message;
9 va_list vargs;
10
11 #ifdef HAVE_STDARG_PROTOTYPES
12 va_start(vargs, format);
13 #else
14 va_start(vargs);
15 #endif
16 message = PyUnicode_FromFormatV(format, vargs);
17 if (message != NULL) {
18 ret = PyErr_WarnEx(category, PyUnicode_AsUTF8(message), stack_level);
19 Py_DECREF(message);
20 }
21 else
22 ret = -1;
23 va_end(vargs);
24 return ret;
25 }
26
27 PyObject *
28 PyErr_FormatV(PyObject * exception, const char * format, va_list vargs) {
29 PyObject * string = PyUnicode_FromFormatV(format, vargs);
30 if (string != NULL) {
31 PyErr_SetObject(exception, string);
32 }
33 return NULL;
34 }