diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-06-08 00:15:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-08 00:15:46 (GMT) |
commit | ffd87b7093109c279caf8e3ca060f408a102388a (patch) | |
tree | b2200c316df8debc1c621da670505b594271b3a2 /Parser/string_parser.c | |
parent | 165c884154901deae46b5e328a6414d130e6bfff (diff) | |
download | cpython-ffd87b7093109c279caf8e3ca060f408a102388a.zip cpython-ffd87b7093109c279caf8e3ca060f408a102388a.tar.gz cpython-ffd87b7093109c279caf8e3ca060f408a102388a.tar.bz2 |
fix: use unambiguous punction in 'invalid escape sequence' message (GH-26582)
Diffstat (limited to 'Parser/string_parser.c')
-rw-r--r-- | Parser/string_parser.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Parser/string_parser.c b/Parser/string_parser.c index b919633..fa41a36 100644 --- a/Parser/string_parser.c +++ b/Parser/string_parser.c @@ -12,7 +12,7 @@ static int warn_invalid_escape_sequence(Parser *p, unsigned char first_invalid_escape_char, Token *t) { PyObject *msg = - PyUnicode_FromFormat("invalid escape sequence \\%c", first_invalid_escape_char); + PyUnicode_FromFormat("invalid escape sequence '\\%c'", first_invalid_escape_char); if (msg == NULL) { return -1; } @@ -27,7 +27,7 @@ warn_invalid_escape_sequence(Parser *p, unsigned char first_invalid_escape_char, since _PyPegen_raise_error uses p->tokens[p->fill - 1] for the error location, if p->known_err_token is not set. */ p->known_err_token = t; - RAISE_SYNTAX_ERROR("invalid escape sequence \\%c", first_invalid_escape_char); + RAISE_SYNTAX_ERROR("invalid escape sequence '\\%c'", first_invalid_escape_char); } Py_DECREF(msg); return -1; |