diff options
Diffstat (limited to 'Parser/tokenizer.c')
-rw-r--r-- | Parser/tokenizer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index f281c42..69d2c08 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c @@ -2045,6 +2045,12 @@ tok_get(struct tok_state *tok, const char **p_start, const char **p_end) break; } + if (!Py_UNICODE_ISPRINTABLE(c)) { + char hex[9]; + (void)PyOS_snprintf(hex, sizeof(hex), "%04X", c); + return syntaxerror(tok, "invalid non-printable character U+%s", hex); + } + /* Punctuation character */ *p_start = tok->start; *p_end = tok->cur; |