diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2023-04-23 00:08:27 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-23 00:08:27 (GMT) |
commit | 0fd38917582aae0728e20d8a641e56d9be9270c7 (patch) | |
tree | 94f2f8734143c52e4854c5a567e507b275df7b59 /Lib/test/test_syntax.py | |
parent | 7bf94568a9a4101c72b8bf555a811028e5b45ced (diff) | |
download | cpython-0fd38917582aae0728e20d8a641e56d9be9270c7.zip cpython-0fd38917582aae0728e20d8a641e56d9be9270c7.tar.gz cpython-0fd38917582aae0728e20d8a641e56d9be9270c7.tar.bz2 |
gh-102310: Change error range for invalid bytes literals (#103663)
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r-- | Lib/test/test_syntax.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index f236535..f959bbb 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -1853,6 +1853,30 @@ x: *b Traceback (most recent call last): ... SyntaxError: invalid syntax + +Invalid bytes literals: + + >>> b"Ā" + Traceback (most recent call last): + ... + b"Ā" + ^^^ + SyntaxError: bytes can only contain ASCII literal characters + + >>> b"абвгде" + Traceback (most recent call last): + ... + b"абвгде" + ^^^^^^^^ + SyntaxError: bytes can only contain ASCII literal characters + + >>> b"abc ъющый" # first 3 letters are ascii + Traceback (most recent call last): + ... + b"abc ъющый" + ^^^^^^^^^^^ + SyntaxError: bytes can only contain ASCII literal characters + """ import re |