summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-01-17 16:35:13 (GMT)
committerGuido van Rossum <guido@python.org>1995-01-17 16:35:13 (GMT)
commit32b582b953f5859de325496df1da9731234b17fa (patch)
treebc36cc7a397244a6b687bee531c6a47dc432875a /Objects
parentb0fe3a9312a9d50f4dde4de351897beb7d39bebf (diff)
downloadcpython-32b582b953f5859de325496df1da9731234b17fa.zip
cpython-32b582b953f5859de325496df1da9731234b17fa.tar.gz
cpython-32b582b953f5859de325496df1da9731234b17fa.tar.bz2
fix strobject() behavior
Diffstat (limited to 'Objects')
-rw-r--r--Objects/object.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/object.c b/Objects/object.c
index be3cce7..63c55ce 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -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);
}