diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-01-13 19:19:16 +0200 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2014-01-15 02:15:38 +0200 |
commit | 76d982ef343dcadd35355aed9c568984c850fb7b (patch) | |
tree | 1ded5f199ce740d3b72c00cc1e9c2b402936632f /py/builtin.c | |
parent | 24224d7c72e1d6572ef0d24f08eb882dcac8dc50 (diff) | |
download | micropython-76d982ef343dcadd35355aed9c568984c850fb7b.tar.gz micropython-76d982ef343dcadd35355aed9c568984c850fb7b.zip |
type->print(): Distinguish str() and repr() variety by passing extra param.
Diffstat (limited to 'py/builtin.c')
-rw-r--r-- | py/builtin.c | 10 |
1 files changed, 2 insertions, 8 deletions
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; |