mirror of
https://github.com/python/cpython.git
synced 2025-07-22 18:55:22 +00:00
[3.11] gh-102310: Change error range for invalid bytes literals (GH-103663) (#103703)
This commit is contained in:
parent
8642fdce8c
commit
7b2ac6cf3d
3 changed files with 27 additions and 1 deletions
|
@ -1803,6 +1803,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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue