Patch #554716: Use __va_copy where available.
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 1f9b603..fc73a9f 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1793,8 +1793,12 @@
#ifdef VA_LIST_IS_ARRAY
memcpy(countva, va, sizeof(va_list));
#else
+#ifdef __va_copy
+ __va_copy(countva, va);
+#else
countva = va;
#endif
+#endif
while (((PyObject *)va_arg(countva, PyObject *)) != NULL)
++n;
diff --git a/Objects/stringobject.c b/Objects/stringobject.c
index 5e40524..bf548cd 100644
--- a/Objects/stringobject.c
+++ b/Objects/stringobject.c
@@ -156,8 +156,12 @@
#ifdef VA_LIST_IS_ARRAY
memcpy(count, vargs, sizeof(va_list));
#else
+#ifdef __va_copy
+ __va_copy(count, vargs);
+#else
count = vargs;
#endif
+#endif
/* step 1: figure out how large a buffer we need */
for (f = format; *f; f++) {
if (*f == '%') {
diff --git a/Python/getargs.c b/Python/getargs.c
index 280ffc3..cc0409d 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -61,8 +61,12 @@
#ifdef VA_LIST_IS_ARRAY
memcpy(lva, va, sizeof(va_list));
#else
+#ifdef __va_copy
+ __va_copy(lva, va);
+#else
lva = va;
#endif
+#endif
return vgetargs1(args, format, &lva, 0);
}
diff --git a/Python/modsupport.c b/Python/modsupport.c
index f4f8298..1f8ef07 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -418,8 +418,12 @@
#ifdef VA_LIST_IS_ARRAY
memcpy(lva, va, sizeof(va_list));
#else
+#ifdef __va_copy
+ __va_copy(lva, va);
+#else
lva = va;
#endif
+#endif
if (n < 0)
return NULL;