summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-02-08 15:49:17 (GMT)
committerGuido van Rossum <guido@python.org>1993-02-08 15:49:17 (GMT)
commitbf80e5407ffa0fc983eb1da50ffa9330b9eada6e (patch)
treece2f5deae53f55af7cbcd5475402517fe4621014 /Python
parent3f2ef09f400524ddb41b1aa4555f924163bfacb9 (diff)
downloadcpython-bf80e5407ffa0fc983eb1da50ffa9330b9eada6e.zip
cpython-bf80e5407ffa0fc983eb1da50ffa9330b9eada6e.tar.gz
cpython-bf80e5407ffa0fc983eb1da50ffa9330b9eada6e.tar.bz2
* stdwinmodule.c: various new commands: setwin{pos,size},
listfontnames, bitmap ops. * listobject.c: use mkvalue() when possible; avoid weird error when calling append() without args. * modsupport.c: new feature in getargs(): if the format string contains a semicolor the string after that is used as the error message instead of "bad argument list (format %s)" when there's an error.
Diffstat (limited to 'Python')
-rw-r--r--Python/modsupport.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c
index f92739a..b464c8e 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -70,7 +70,7 @@ initmodule(name, methods)
}
-/* Helper for getargs() and mkvalue() to scan the length of a format */
+/* Helper for mkvalue() to scan the length of a format */
static int countformat PROTO((char *format, int endchar));
static int countformat(format, endchar)
@@ -292,24 +292,34 @@ int getargs(va_alist) va_dcl
arg = va_arg(va, object *);
format = va_arg(va, char *);
#endif
- if (*format == '\0') {
+ if (*format == '\0' || *format == ';') {
va_end(va);
if (arg != NULL) {
- err_setstr(TypeError, "no arguments needed");
+ char *str = "no arguments needed";
+ if (*format == ';')
+ str = format+1;
+ err_setstr(TypeError, str);
return 0;
}
return 1;
}
f = format;
- ok = do_arg(arg, &f, &va) && *f == '\0';
+ ok = do_arg(arg, &f, &va) && (*f == '\0' || *f == ';');
va_end(va);
if (!ok) {
- char buf[256];
if (!err_occurred()) {
- sprintf(buf, "bad argument list (format '%s')",
- format);
- err_setstr(TypeError, buf);
+ char buf[256];
+ char *str;
+ f = strchr(format, ';');
+ if (f != NULL)
+ str = f+1;
+ else {
+ sprintf(buf, "bad argument list (format '%s')",
+ format);
+ str = buf;
+ }
+ err_setstr(TypeError, str);
}
}
return ok;