diff options
author | Damien George <damien.p.george@gmail.com> | 2014-04-08 12:11:40 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-04-08 12:11:40 +0100 |
commit | ff5639fd4230dd6c13be01288e88e9d0d4647afb (patch) | |
tree | fcd35594281d64461bbd9f11a380630cf42d8007 /py/objstr.c | |
parent | 97790455fe10c5fb22bc3edde2b43474ce0dbaad (diff) | |
parent | 12968fb6b24fa3e28e4b4f9cb7928579a9477318 (diff) | |
download | micropython-ff5639fd4230dd6c13be01288e88e9d0d4647afb.tar.gz micropython-ff5639fd4230dd6c13be01288e88e9d0d4647afb.zip |
Merge pull request #451 from lurch/repr-fixes
Display \r and \t escape codes in string repr
Diffstat (limited to 'py/objstr.c')
-rw-r--r-- | py/objstr.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/py/objstr.c b/py/objstr.c index 4c09871b96..d2d672b983 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -63,7 +63,10 @@ void mp_str_print_quoted(void (*print)(void *env, const char *fmt, ...), void *e print(env, "%c", *s); } else if (*s == '\n') { print(env, "\\n"); - // TODO add more escape codes here if we want to match CPython + } else if (*s == '\r') { + print(env, "\\r"); + } else if (*s == '\t') { + print(env, "\\t"); } else { print(env, "\\x%02x", *s); } |