You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(馃悶) Column marker in error message off for certain string errors聽#102312
馃憠 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
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.
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
Activity
arhadthedev commentedon Feb 28, 2023
Reproduced in the CLI too:
By the way, the interpreter hangs for around five seconds on first execution of
\N{a}with no delay on further attempts.KotlinIsland commentedon Feb 28, 2023
@arhadthedev Am I missing something? I Can't see any caret in your repro.
arhadthedev commentedon Feb 28, 2023
@KotlinIsland Thank you, updated my initially undercopied output.
arhadthedev commentedon Feb 28, 2023
@benjaminp, @pablogsal (as parser experts)
update: @gvanrossum, @lysnikolaou (as new parser experts)
terryjreedy commentedon 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
compileslightly differently.Get same messages in REPL compiled 2 hours ago and in installed 3.12.0a5 and installed 3.10.10.
gvanrossum commentedon Feb 28, 2023
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 commentedon Feb 28, 2023
PS. If Benjamin is still listed as parser expert that's likely out of date.
terryjreedy commentedon Feb 28, 2023
#102310, about same problem with b"膧". Sorry about bad link (now fixed).
KotlinIsland commentedon Feb 28, 2023
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.