Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
0be3c70c
Commit
0be3c70c
authored
Sep 07, 2015
by
Damien George
Browse files
py/lexer: Raise SyntaxError when unicode char point out of range.
parent
081f9325
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/lexer.c
View file @
0be3c70c
...
...
@@ -500,7 +500,9 @@ STATIC void mp_lexer_next_token_into(mp_lexer_t *lex, bool first_token) {
}
#endif
else
{
assert
(
!
"TODO: Throw an error, invalid escape code probably"
);
// unicode character out of range
// this raises a generic SyntaxError; could provide more info
lex
->
tok_kind
=
MP_TOKEN_INVALID
;
}
}
}
else
{
...
...
tests/unicode/unicode.py
View file @
0be3c70c
...
...
@@ -20,3 +20,9 @@ print(enc, enc.decode() == s)
# printing of unicode chars using repr
# TODO we don't do this correctly
#print(repr(s))
# test invalid escape code
try
:
eval
(
'"
\\
U00110000"'
)
except
SyntaxError
:
print
(
'SyntaxError'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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