-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed as not planned
Closed as not planned
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Description
Bug report
Bug description:
>>> codecs.decode('\u{0041}',encoding='unicode-escape')
File "<python-input-2>", line 1
codecs.decode('\u{0041}',encoding='unicode-escape')
^^^^^^^^^^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: truncated \uXXXX escape
>>> codecs.decode('\u0041',encoding='unicode-escape')
'A'
>>> '\u{0041}'
File "<python-input-4>", line 1
'\u{0041}'
^^^^^^^^^^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: truncated \uXXXX escape
>>> '\u0041'
'A'
I'm not sure when the \u{xxx} escape was introduced to the world, but it should be recognized by codecs.decode
and the Python interpreter. The above sample was run on Python 3.13.1 on Windows.
CPython versions tested on:
3.13
Operating systems tested on:
No response
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-featureA feature request or enhancementA feature request or enhancement
Projects
Status
Done