Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-40246: Revert reporting of invalid string prefixes #19888

Merged
merged 4 commits into from
May 4, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion Include/errcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ extern "C" {
#define E_LINECONT 25 /* Unexpected characters after a line continuation */
#define E_IDENTIFIER 26 /* Invalid characters in identifier */
#define E_BADSINGLE 27 /* Ill-formed single statement input */
#define E_BADPREFIX 28 /* Bad string prefixes */

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ def test_invalid_string_prefixes(self):
"Bf''",
"BF''",]
double_quote_cases = [case.replace("'", '"') for case in single_quote_cases]
self.assertAllRaise(SyntaxError, 'invalid string prefix',
self.assertAllRaise(SyntaxError, 'unexpected EOF while parsing',
single_quote_cases + double_quote_cases)

def test_leading_trailing_spaces(self):
Expand Down
3 changes: 0 additions & 3 deletions Parser/pegen/pegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,6 @@ tokenizer_error(Parser *p)
case E_IDENTIFIER:
msg = "invalid character in identifier";
break;
case E_BADPREFIX:
RAISE_SYNTAX_ERROR("invalid string prefix");
return -1;
case E_EOFS:
RAISE_SYNTAX_ERROR("EOF while scanning triple-quoted string literal");
return -1;
Expand Down
4 changes: 0 additions & 4 deletions Parser/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1396,10 +1396,6 @@ tok_get(struct tok_state *tok, const char **p_start, const char **p_end)
*p_start = tok->start;
*p_end = tok->cur;

if (c == '"' || c == '\'') {
tok->done = E_BADPREFIX;
return ERRORTOKEN;
}
/* async/await parsing block. */
if (tok->cur - tok->start == 5 && tok->start[0] == 'a') {
/* May be an 'async' or 'await' token. For Python 3.7 or
Expand Down
3 changes: 0 additions & 3 deletions Python/pythonrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -1609,9 +1609,6 @@ err_input(perrdetail *err)
case E_BADSINGLE:
msg = "multiple statements found while compiling a single statement";
break;
case E_BADPREFIX:
msg = "invalid string prefix";
break;
default:
fprintf(stderr, "error=%d\n", err->error);
msg = "unknown parsing error";
Expand Down