fix strobject() behavior

This commit is contained in:
Guido van Rossum 1995-01-17 16:35:13 +00:00
parent b0fe3a9312
commit 32b582b953
1 changed files with 4 additions and 2 deletions

View File

@ -181,11 +181,13 @@ strobject(v)
INCREF(v);
return v;
}
else if (v->ob_type->tp_str != NULL)
return (*v->ob_type->tp_str)(v);
else {
object *func = getattr(v, "__str__");
object *func;
object *args;
object *res;
if (func == NULL) {
if (!is_instanceobject(v) || (func = getattr(v, "__str__")) == NULL) {
err_clear();
return reprobject(v);
}