mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
fix strobject() behavior
This commit is contained in:
parent
b0fe3a9312
commit
32b582b953
1 changed files with 4 additions and 2 deletions
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue