]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
args to call_object must be tuple or NULL
authorGuido van Rossum <guido@python.org>
Wed, 12 Jul 1995 02:22:06 +0000 (02:22 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 12 Jul 1995 02:22:06 +0000 (02:22 +0000)
Objects/classobject.c
Objects/listobject.c
Objects/object.c

index 6ef17b2f56c8b77468744e03f7864f91d34193ad..9870b6e77e969fe7c3aa4e2ac80c9dcaa0b39b30 100644 (file)
@@ -344,11 +344,7 @@ instance_dealloc(inst)
        INCREF(inst);
        err_fetch(&error_type, &error_value, &error_traceback);
        if ((del = instance_getattr1(inst, "__del__")) != NULL) {
-               object *args = newtupleobject(0);
-               object *res = args;
-               if (res != NULL)
-                       res = call_object(del, args);
-               XDECREF(args);
+               object *res = call_object(del, (object *)NULL);
                DECREF(del);
                XDECREF(res);
                /* XXX If __del__ raised an exception, it is ignored! */
@@ -692,7 +688,7 @@ instance_item(inst, i)
        func = instance_getattr(inst, "__getitem__");
        if (func == NULL)
                return NULL;
-       arg = newintobject((long)i);
+       arg = mkvalue("(i)", i);
        if (arg == NULL) {
                DECREF(func);
                return NULL;
index 44003bc9ce002f089783f37eec9444bc50f185d7..b3e3378c887ea33d80cf2da0f98c171022ed0cc3 100644 (file)
@@ -553,7 +553,7 @@ cmp(v, w)
                return cmpobject(* (object **) v, * (object **) w);
 
        /* Call the user-supplied comparison function */
-       t = mkvalue("OO", * (object **) v, * (object **) w);
+       t = mkvalue("(OO)", * (object **) v, * (object **) w);
        if (t == NULL)
                return 0;
        res = call_object(comparefunc, t);
index d7110ae852af5c4bbc1479237a895a63cc3c51d3..1643ec6fc1c8968269f474d2ae7da5c13cd27a7a 100644 (file)
@@ -177,7 +177,7 @@ strobject(v)
 {
        if (v == NULL)
                return newstringobject("<NULL>");
-       if (is_stringobject(v)) {
+       else if (is_stringobject(v)) {
                INCREF(v);
                return v;
        }
@@ -185,19 +185,13 @@ strobject(v)
                return (*v->ob_type->tp_str)(v);
        else {
                object *func;
-               object *args;
                object *res;
-               if (!is_instanceobject(v) || (func = getattr(v, "__str__")) == NULL) {
+               if (!is_instanceobject(v) ||
+                   (func = getattr(v, "__str__")) == NULL) {
                        err_clear();
                        return reprobject(v);
                }
-               args = newtupleobject(0);
-               if (args == NULL)
-                       res = NULL;
-               else {
-                       res = call_object(func, args);
-                       DECREF(args);
-               }
+               res = call_object(func, (object *)NULL);
                DECREF(func);
                return res;
        }