int PyErr_WarnEx(PyObject *category, const char *text, Py_ssize_t stack_level) { int ret; PyObject *message = PyUnicode_FromString(text); if (message == NULL) return -1; ret = warn_unicode(category, message, stack_level, NULL); Py_DECREF(message); return ret; }
static int _PyErr_WarnFormatV(PyObject *source, PyObject *category, Py_ssize_t stack_level, const char *format, va_list vargs) { PyObject *message; int res; message = PyUnicode_FromFormatV(format, vargs); if (message == NULL) return -1; res = warn_unicode(category, message, stack_level, source); Py_DECREF(message); return res; }
int PyErr_WarnFormat(PyObject *category, Py_ssize_t stack_level, const char *format, ...) { int ret; PyObject *message; va_list vargs; #ifdef HAVE_STDARG_PROTOTYPES va_start(vargs, format); #else va_start(vargs); #endif message = PyUnicode_FromFormatV(format, vargs); if (message != NULL) { ret = warn_unicode(category, message, stack_level); Py_DECREF(message); } else ret = -1; va_end(vargs); return ret; }