diff options
author | Guido van Rossum <guido@python.org> | 1993-02-08 15:49:17 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1993-02-08 15:49:17 (GMT) |
commit | bf80e5407ffa0fc983eb1da50ffa9330b9eada6e (patch) | |
tree | ce2f5deae53f55af7cbcd5475402517fe4621014 /Objects/listobject.c | |
parent | 3f2ef09f400524ddb41b1aa4555f924163bfacb9 (diff) | |
download | cpython-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 'Objects/listobject.c')
-rw-r--r-- | Objects/listobject.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index 474932f..9a1fe23 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -458,13 +458,10 @@ listinsert(self, args) object *args; { int i; - if (args == NULL || !is_tupleobject(args) || gettuplesize(args) != 2) { - err_badarg(); - return NULL; - } - if (!getintarg(gettupleitem(args, 0), &i)) + object *v; + if (!getargs(args, "(iO)", &i, &v)) return NULL; - return ins(self, i, gettupleitem(args, 1)); + return ins(self, i, v); } static object * @@ -472,7 +469,10 @@ listappend(self, args) listobject *self; object *args; { - return ins(self, (int) self->ob_size, args); + object *v; + if (!getargs(args, "O", &v)) + return NULL; + return ins(self, (int) self->ob_size, v); } static object *cmpfunc; @@ -495,13 +495,9 @@ cmp(v, w) return cmpobject(* (object **) v, * (object **) w); /* Call the user-supplied comparison function */ - t = newtupleobject(2); + t = mkvalue("OO", v, w); if (t == NULL) return 0; - INCREF(* (object **) v); - settupleitem(t, 0, * (object **) v); - INCREF(* (object **) w); - settupleitem(t, 1, * (object **) w); res = call_object(cmpfunc, t); DECREF(t); if (res == NULL) |