Open
Description
Bug report
Bug description:
I noticed a strange behavior of the pointer in the form of an upward arrow indicating where the error is.
In 3.10 version there is OK
Python 3.10.12 (main, Feb 4 2025, 14:57:36) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> A[*]
File "<stdin>", line 1
A[*]
^
SyntaxError: invalid syntax
But in 3.12 and later (sorry there is no 3.11 version on my computer) the up arrow pointer has moved to the right, which is a little confusing.
Python 3.12.2 (main, Feb 15 2024, 13:20:42) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> A[*]
File "<stdin>", line 1
A[*]
^
SyntaxError: invalid syntax
Same with other expressions:
Python 3.14.0a7+ (heads/main:c46635aa5a2, Apr 29 2025, 21:48:33) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> A[*(1:2)] = 1
File "<python-input-0>", line 1
A[*(1:2)] = 1
^
SyntaxError: Invalid star expression
More examples in:
del A[*(1:2)]
A[*:]
A[:*]
A[*]
f(**x, *)
and so on...
After this commit (Fix syntax error in handlinh of incorrect star expressions) the error prints as "Invalid star expression
", but the pointer in the form of an upward arrow indicating where the error is not point to the star expression. Earlier that commit it's moved to the right.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux