Kaydet (Commit) 32b582b9 authored tarafından Guido van Rossum's avatar Guido van Rossum

fix strobject() behavior

üst b0fe3a93
...@@ -181,11 +181,13 @@ strobject(v) ...@@ -181,11 +181,13 @@ strobject(v)
INCREF(v); INCREF(v);
return v; return v;
} }
else if (v->ob_type->tp_str != NULL)
return (*v->ob_type->tp_str)(v);
else { else {
object *func = getattr(v, "__str__"); object *func;
object *args; object *args;
object *res; object *res;
if (func == NULL) { if (!is_instanceobject(v) || (func = getattr(v, "__str__")) == NULL) {
err_clear(); err_clear();
return reprobject(v); return reprobject(v);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment