mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
args to call_object must be tuple or NULL
This commit is contained in:
parent
b89ab8c6d2
commit
1311e3ce73
3 changed files with 7 additions and 17 deletions
|
|
@ -344,11 +344,7 @@ instance_dealloc(inst)
|
||||||
INCREF(inst);
|
INCREF(inst);
|
||||||
err_fetch(&error_type, &error_value, &error_traceback);
|
err_fetch(&error_type, &error_value, &error_traceback);
|
||||||
if ((del = instance_getattr1(inst, "__del__")) != NULL) {
|
if ((del = instance_getattr1(inst, "__del__")) != NULL) {
|
||||||
object *args = newtupleobject(0);
|
object *res = call_object(del, (object *)NULL);
|
||||||
object *res = args;
|
|
||||||
if (res != NULL)
|
|
||||||
res = call_object(del, args);
|
|
||||||
XDECREF(args);
|
|
||||||
DECREF(del);
|
DECREF(del);
|
||||||
XDECREF(res);
|
XDECREF(res);
|
||||||
/* XXX If __del__ raised an exception, it is ignored! */
|
/* XXX If __del__ raised an exception, it is ignored! */
|
||||||
|
|
@ -692,7 +688,7 @@ instance_item(inst, i)
|
||||||
func = instance_getattr(inst, "__getitem__");
|
func = instance_getattr(inst, "__getitem__");
|
||||||
if (func == NULL)
|
if (func == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
arg = newintobject((long)i);
|
arg = mkvalue("(i)", i);
|
||||||
if (arg == NULL) {
|
if (arg == NULL) {
|
||||||
DECREF(func);
|
DECREF(func);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
|
|
@ -553,7 +553,7 @@ cmp(v, w)
|
||||||
return cmpobject(* (object **) v, * (object **) w);
|
return cmpobject(* (object **) v, * (object **) w);
|
||||||
|
|
||||||
/* Call the user-supplied comparison function */
|
/* Call the user-supplied comparison function */
|
||||||
t = mkvalue("OO", * (object **) v, * (object **) w);
|
t = mkvalue("(OO)", * (object **) v, * (object **) w);
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
res = call_object(comparefunc, t);
|
res = call_object(comparefunc, t);
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ strobject(v)
|
||||||
{
|
{
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
return newstringobject("<NULL>");
|
return newstringobject("<NULL>");
|
||||||
if (is_stringobject(v)) {
|
else if (is_stringobject(v)) {
|
||||||
INCREF(v);
|
INCREF(v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
@ -185,19 +185,13 @@ strobject(v)
|
||||||
return (*v->ob_type->tp_str)(v);
|
return (*v->ob_type->tp_str)(v);
|
||||||
else {
|
else {
|
||||||
object *func;
|
object *func;
|
||||||
object *args;
|
|
||||||
object *res;
|
object *res;
|
||||||
if (!is_instanceobject(v) || (func = getattr(v, "__str__")) == NULL) {
|
if (!is_instanceobject(v) ||
|
||||||
|
(func = getattr(v, "__str__")) == NULL) {
|
||||||
err_clear();
|
err_clear();
|
||||||
return reprobject(v);
|
return reprobject(v);
|
||||||
}
|
}
|
||||||
args = newtupleobject(0);
|
res = call_object(func, (object *)NULL);
|
||||||
if (args == NULL)
|
|
||||||
res = NULL;
|
|
||||||
else {
|
|
||||||
res = call_object(func, args);
|
|
||||||
DECREF(args);
|
|
||||||
}
|
|
||||||
DECREF(func);
|
DECREF(func);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue