Error display for invalid literal is incorrect
Open
Nobody has claimed this yet.
interpreter-core
topic-parser
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
If you run
0x9g
Anywhere (I did it in the REPL), the pointer that shows where the error happened is on 9, even though it is valid:
>>> 0x9g
File "<stdin>", line 1
0x9g
^
SyntaxError: invalid hexadecimal literal
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
- gh-149456
- gh-155534
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in the Python REPL with 0x9g, then inspect linked PRs gh-149456 and gh-155534 to understand the current work. Trace the syntax-error location reporting for invalid literals and verify that the caret identifies the invalid part rather than the valid 9.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100