Commits

Anonymous committed 899b4e3

fix strobject() behavior

  • Participants
  • Parent commits a619a61
  • Branches legacy-trunk

Comments (0)

Files changed (1)

File Objects/object.c

 		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);
 		}