GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — Wrong `SyntaxError.offset` for "Non-UTF-8 code starting with ..." when a non-ASCII character precedes the invalid byte · Issue #157378 · python/cpython Closed Labels interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-parsertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug description:
Reproductioncompile(b'\xc3\xa9X\x80', '<bug>', 'exec') Same via a file: $ printf '\xc3\xa9X\x80' > bug.py $ ./python bug.py The input is ExpectedFile "<bug>", line 1 éX ^ SyntaxError: Non-UTF-8 code starting with '\x80' on line 1, but no encoding declared; ...
ActualFile "<bug>", line 1 éX ^ SyntaxError: Non-UTF-8 code starting with '\x80' on line 1, but no encoding declared; ...
Observed values:
More inputs on main, all one column short per preceding multi-byte character: compile(b'\xc3\xa9abc\x80', ...) # offset 4, expected 5 compile(b'\t\xc3\xa9X\x80', ...) # offset 3, expected 4 compile(b'a\xc3\xa9b\x80c', ...) # offset 3, expected 4 Cause
Since 59a6913 (gh-156894, PR #156901), The same function is unchanged on current main (b1e7554). Suggested fixPass byte columns from Tests
CPython versions tested on:CPython main branch Operating systems tested on:Linux Linked PRsActivity
MetadataMetadataAssigneesLabelsinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-parsertype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||||||||||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |