for paren in ")]}":
self._check_error(paren + "1 + 2", f"unmatched '\\{paren}'")
+ def test_invisible_characters(self):
+ self._check_error('print\x17("Hello")', "invalid non-printable character")
+
def test_match_call_does_not_raise_syntax_error(self):
code = """
def match(x):
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;