summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 15cd4e6..1232fd0 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -38,7 +38,7 @@ int vgetargs PROTO((object *, char *, va_list));
/* Forward */
-static int vgetargs1 PROTO((object *, char *, va_list, int));
+static int vgetargs1 PROTO((object *, char *, va_list *, int));
static void seterror PROTO((int, char *, int *, char *, char *));
static char *convertitem PROTO((object *, char **, va_list *, int *, char *));
static char *converttuple PROTO((object *, char **, va_list *,
@@ -68,7 +68,7 @@ int getargs(va_alist) va_dcl
args = va_arg(va, object *);
format = va_arg(va, char *);
#endif
- retval = vgetargs1(args, format, va, 1);
+ retval = vgetargs1(args, format, &va, 1);
va_end(va);
return retval;
}
@@ -95,7 +95,7 @@ int newgetargs(va_alist) va_dcl
args = va_arg(va, object *);
format = va_arg(va, char *);
#endif
- retval = vgetargs1(args, format, va, 0);
+ retval = vgetargs1(args, format, &va, 0);
va_end(va);
return retval;
}
@@ -107,15 +107,23 @@ vgetargs(args, format, va)
char *format;
va_list va;
{
- return vgetargs1(args, format, va, 0);
+ va_list lva;
+
+#ifdef VA_LIST_IS_ARRAY
+ memcpy(lva, va, sizeof(va_list));
+#else
+ lva = va;
+#endif
+
+ return vgetargs1(args, format, &lva, 0);
}
static int
-vgetargs1(args, format, va, compat)
+vgetargs1(args, format, p_va, compat)
object *args;
char *format;
- va_list va;
+ va_list *p_va;
int compat;
{
char msgbuf[256];
@@ -186,7 +194,7 @@ vgetargs1(args, format, va, compat)
err_setstr(TypeError, msgbuf);
return 0;
}
- msg = convertitem(args, &format, &va, levels, msgbuf);
+ msg = convertitem(args, &format, p_va, levels, msgbuf);
if (msg == NULL)
return 1;
seterror(levels[0], msg, levels+1, fname, message);
@@ -226,7 +234,7 @@ vgetargs1(args, format, va, compat)
for (i = 0; i < len; i++) {
if (*format == '|')
format++;
- msg = convertitem(gettupleitem(args, i), &format, &va,
+ msg = convertitem(gettupleitem(args, i), &format, p_va,
levels, msgbuf);
if (msg) {
seterror(i+1, msg, levels, fname, message);