GeezerVison is showing github.com โ (๐) Column marker in error message off for certain string errors ยท Issue #102312 ยท python/cpython
(๐) Column marker in error message off for certain string errors #102312Labels interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error Description
๐ python test.py
File "/test.py", line 1
"\N{a}"
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-4: unknown Unicode character name
Here the caret is pointing to blackspace after the code
Expected
๐ python test.py
File "/test.py", line 1
"\N{a}"
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-4: unknown Unicode character name
Reacted by DetachHead and Oleg Iarygin Activityarhadthedev commented on Feb 28, 2023 Reproduced in the CLI too:
>>> "\N{a}"
File "<stdin>", line 1
"\N{a}"
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-4: unknown Unicode character name
By the way, the interpreter hangs for around five seconds on first execution of \N{a} with no delay on further attempts. KotlinIsland commented on Feb 28, 2023 ContributorAuthor More actions @arhadthedev Am I missing something? I Can't see any caret in your repro. arhadthedev commented on Feb 28, 2023 @KotlinIsland Thank you, updated my initially undercopied output. arhadthedev commented on Feb 28, 2023 terryjreedy commented on Feb 28, 2023 This is likely a duplicate of #102310.
Testing with Python 3.12.0a5+ (heads/main:0f89acf6cc, Feb 27 2023, 21:33:28), message is "incomplete input" and closing quote is marked. I interpret this as having been fixed already.
EDIT: the different message is because I initially ran in IDLE, which uses codeop, which uses compile slightly differently.
Get same messages in REPL compiled 2 hours ago and in installed 3.12.0a5 and installed 3.10.10. gvanrossum commented on Feb 28, 2023
By the way, the interpreter hangs for around five seconds on first execution of \N{a} with no delay on further attempts.
Could that just be importing the (humongous) unicodedata module to resolve the name?
@terryjreedy What is it a duplicate of? Your link points to this same issue. gvanrossum commented on Feb 28, 2023 PS. If Benjamin is still listed as parser expert that's likely out of date. terryjreedy commented on Feb 28, 2023 #102310, about same problem with b"ฤ". Sorry about bad link (now fixed). KotlinIsland commented on Feb 28, 2023 ContributorAuthor More actions I don't think it's the same issue as #102310, in that issue the column marker is offset by a non ascii character, in this issue the marker appears after the string. While this issue does make an appearance in #102310, I do feel that they are distinct.
๐ $c:temp = "'\N{a}'"
๐ py temp
File "C:\temp", line 1
'\N{a}'
^
๐ $c:temp = "b'ฤ'"
๐ py temp
File "C:\temp", line 1
b'ฤ'
^
๐ $c:temp = "b'ฤฤฤฤฤฤฤฤ'"
๐ py temp
File "C:\temp", line 1
b'ฤฤฤฤฤฤฤฤ'
^
SyntaxError: bytes can only contain ASCII literal characters
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-4: unknown Unicode character name
MetadataMetadatainterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DevelopmentNo branches or pull requestsIssue actions
|