Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
12968fb6
Commit
12968fb6
authored
Apr 08, 2014
by
Andrew Scheller
Browse files
Display \r and \t escape codes in string repr
parent
72d70cb0
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/objstr.c
View file @
12968fb6
...
...
@@ -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
);
}
...
...
tests/basics/string-repr.py
0 → 100644
View file @
12968fb6
# anything above 0xa0 is printed as Unicode by CPython3.3
for
c
in
range
(
0xa1
):
print
(
"0x%02x: %s"
%
(
c
,
repr
(
chr
(
c
))))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment