summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorAndrew Scheller <github@loowis.durge.org>2014-04-08 02:42:50 +0100
committerAndrew Scheller <github@loowis.durge.org>2014-04-08 02:42:50 +0100
commit12968fb6b24fa3e28e4b4f9cb7928579a9477318 (patch)
tree09e58e7b74e6aa25250c3463a9df3609dc7753ca /py
parent72d70cb0455c61ee963d9063bd42a8b0f6c80789 (diff)
downloadmicropython-12968fb6b24fa3e28e4b4f9cb7928579a9477318.tar.gz
micropython-12968fb6b24fa3e28e4b4f9cb7928579a9477318.zip
Display \r and \t escape codes in string repr
Diffstat (limited to 'py')
-rw-r--r--py/objstr.c5
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);
}