From 76d982ef343dcadd35355aed9c568984c850fb7b Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 13 Jan 2014 19:19:16 +0200 Subject: type->print(): Distinguish str() and repr() variety by passing extra param. --- py/builtin.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'py/builtin.c') diff --git a/py/builtin.c b/py/builtin.c index 8f93e843b5..a45b1463d9 100644 --- a/py/builtin.c +++ b/py/builtin.c @@ -64,7 +64,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR(mp_builtin___build_class___obj, 2, mp_builtin___buil static mp_obj_t mp_builtin___repl_print__(mp_obj_t o) { if (o != mp_const_none) { - mp_obj_print(o); + mp_obj_print(o, PRINT_REPR); printf("\n"); } return mp_const_none; @@ -285,13 +285,7 @@ static mp_obj_t mp_builtin_print(int n_args, const mp_obj_t *args) { if (i > 0) { printf(" "); } - if (MP_OBJ_IS_TYPE(args[i], &str_type)) { - // special case, print string raw - printf("%s", qstr_str(mp_obj_str_get(args[i]))); - } else { - // print the object Python style - mp_obj_print(args[i]); - } + mp_obj_print(args[i], PRINT_STR); } printf("\n"); return mp_const_none; -- cgit v1.2.3