summaryrefslogtreecommitdiff
path: root/Python/errors.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-10-06 17:51:53 +0200
committerGeorg Brandl <georg@python.org>2014-10-06 17:51:53 +0200
commit9d2ec0c84470eb9fdec4fe87cb223a425370e6c3 (patch)
tree3114c6929ece3426beda5e1910070133715faeff /Python/errors.c
parent53230dae4fce857df51a921150058eb07deca019 (diff)
parentb825edd615e1c95f78c3dfc601af978f967618f0 (diff)
downloadcpython-9d2ec0c84470eb9fdec4fe87cb223a425370e6c3.tar.gz
merge with 3.4
Diffstat (limited to 'Python/errors.c')
-rw-r--r--Python/errors.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/Python/errors.c b/Python/errors.c
index 996292a044..fd55142525 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -749,19 +749,11 @@ PyErr_BadInternalCall(void)
#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__)
-
PyObject *
-PyErr_Format(PyObject *exception, const char *format, ...)
+PyErr_FormatV(PyObject *exception, const char *format, va_list vargs)
{
- va_list vargs;
PyObject* string;
-#ifdef HAVE_STDARG_PROTOTYPES
- va_start(vargs, format);
-#else
- va_start(vargs);
-#endif
-
#ifdef Py_DEBUG
/* in debug mode, PyEval_EvalFrameEx() fails with an assertion error
if an exception is set when it is called */
@@ -771,11 +763,24 @@ PyErr_Format(PyObject *exception, const char *format, ...)
string = PyUnicode_FromFormatV(format, vargs);
PyErr_SetObject(exception, string);
Py_XDECREF(string);
- va_end(vargs);
return NULL;
}
+PyObject *
+PyErr_Format(PyObject *exception, const char *format, ...)
+{
+ va_list vargs;
+#ifdef HAVE_STDARG_PROTOTYPES
+ va_start(vargs, format);
+#else
+ va_start(vargs);
+#endif
+ PyErr_FormatV(exception, format, vargs);
+ va_end(vargs);
+ return NULL;
+}
+
PyObject *
PyErr_NewException(const char *name, PyObject *base, PyObject *dict)