From 12968fb6b24fa3e28e4b4f9cb7928579a9477318 Mon Sep 17 00:00:00 2001 From: Andrew Scheller Date: Tue, 8 Apr 2014 02:42:50 +0100 Subject: Display \r and \t escape codes in string repr --- py/objstr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'py/objstr.c') diff --git a/py/objstr.c b/py/objstr.c index 4c09871b9..d2d672b98 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); } -- cgit v1.2.3