summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-07-12 02:22:06 (GMT)
committerGuido van Rossum <guido@python.org>1995-07-12 02:22:06 (GMT)
commit1311e3ce73263854e3899d14cc636ccfa166eebf (patch)
treef266a6a8d552f9b340a46c2168683a08d9c7de38
parentb89ab8c6d23378f6be75978050c1b41d838f6269 (diff)
downloadcpython-1311e3ce73263854e3899d14cc636ccfa166eebf.zip
cpython-1311e3ce73263854e3899d14cc636ccfa166eebf.tar.gz
cpython-1311e3ce73263854e3899d14cc636ccfa166eebf.tar.bz2
args to call_object must be tuple or NULL
-rw-r--r--Objects/classobject.c8
-rw-r--r--Objects/listobject.c2
-rw-r--r--Objects/object.c14
3 files changed, 7 insertions, 17 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index 6ef17b2..9870b6e 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -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;
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 44003bc..b3e3378 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -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);
diff --git a/Objects/object.c b/Objects/object.c
index d7110ae..1643ec6 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -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;
}