Repository navigation
(🐞) Column marker in error message off when line contains non ASCII character #102310
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Feb 28, 2023 - addedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
on Feb 28, 2023 Can confirm on
Python 3.12.0a5+ (heads/main:bcadcde712, Feb 26 2023, 12:54:46) [MSC v.1929 64 bit (AMD64)] on win32.Note:
Āhere is UTF8-encoded asC4 80(a single U+0100 LATIN CAPITAL LETTER A WITH MACRON). So incorrect row advancing on combined code points is totally ruled out until text normalization happens inside the parser.- changed the title
[-](🐞) Column marker in error message off for bytes with non ASCII character[/-][+](🐞) Column marker in error message off when line contains non ASCII character[/+]on Feb 28, 2023 @benjaminp, @pablogsal (as parser experts)
update: @gvanrossum, @lysnikolaou (as new parser experts)
- added3.11only security fixesonly security fixes3.10 (EOL)end of lifeend of life3.12only security fixesonly security fixes
on Feb 28, 2023 Verified bug in installed 3.10.10, 3.11.2, and 3.12.a5.
What do you think about this?
» ./python.exe ex.py File "/Users/sobolev/Desktop/cpython/ex.py", line 1 x = b"Ā" ^^^^^ SyntaxError: bytes can only contain ASCII literal charactersOr do we need to highlight the symbol exactly?
If my solution is fine, I can add a test case and send a PR.Reacted by Oleg IaryginIf my solution is fine, I can add a test case and send a PR.
@sobolevn In absence of other feedback, your solution looks better than nothing. So it's worth to create a PR and get it merged before 3.12b1.
Will do :)
Reacted by Oleg Iarygin- added a commit that references this issue
on Apr 21, 2023 Can this be closed?
Edit: Actually, I'm closing this. Re-open in case there's more to it.

b"Ā"Here the caret is pointing to blackspace after the code
So each non-ASCII character is adding more incorrect offset:
Expected
Linked PRs