summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/stringobject.c7
-rw-r--r--Python/errors.c2
2 files changed, 7 insertions, 2 deletions
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index cfa5f53..a43f129 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -150,12 +150,17 @@ PyString_FromString(const char *str)
PyObject *
PyString_FromFormatV(const char *format, va_list vargs)
{
- va_list count = vargs;
+ va_list count;
int n = 0;
const char* f;
char *s;
PyObject* string;
+#ifdef VA_LIST_IS_ARRAY
+ memcpy(count, vargs, sizeof(va_list));
+#else
+ count = vargs;
+#endif
/* step 1: figure out how large a buffer we need */
for (f = format; *f; f++) {
if (*f == '%') {
diff --git a/Python/errors.c b/Python/errors.c
index c37d86b..2799cff 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -407,7 +407,7 @@ PyErr_Format(PyObject *exception, const char *format, ...)
string = PyString_FromFormatV(format, vargs);
PyErr_SetObject(exception, string);
Py_XDECREF(string);
-
+ va_end(vargs);
return NULL;
}