[3.11] gh-102310: Change error range for invalid bytes literals (GH-103663) (#103703)

This commit is contained in:
Miss Islington (bot) 2023-04-23 16:21:27 -07:00 committed by GitHub
parent 8642fdce8c
commit 7b2ac6cf3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 1 deletions

View file

@ -259,7 +259,8 @@ _PyPegen_parsestr(Parser *p, int *bytesmode, int *rawmode, PyObject **result,
const char *ch;
for (ch = s; *ch; ch++) {
if (Py_CHARMASK(*ch) >= 0x80) {
RAISE_SYNTAX_ERROR(
RAISE_SYNTAX_ERROR_KNOWN_LOCATION(
t,
"bytes can only contain ASCII "
"literal characters");
return -1;