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
Thanks for the bug report. This error message is not actually coming from the preparser. The ellipsis preparser does raise an exception:
SyntaxError: unbalanced or missing delimiters
However, this exception is ignored (lines 1784 to 1787 of src/sage/repl/preparse.py):
try:
L = parse_ellipsis(L, preparse_step=False)
except SyntaxError:
pass
Because it raises an error instead of returning a value, the parse_ellipsis method doesn't end up doing anything, so the original (un-preparsed) code is passed to python. The first .. in the code hasn't been preparsed (it is still[Integer(0)..Integer(2)] instead of (ellipsis_range(Integer(1),Ellipsis,Integer(2))), so this is not valid python. This results in the SyntaxError that we see when the code is executed.
There doesn't seem to be much point in having parse_ellipsis raise an exception that is going to be ignored, so perhaps a way to fix the problem would be to add a boolean keyword argument to parse_ellipsis telling it not to raise a SyntaxError, and instead return a string after doing as much preparsing as possible. In the given example, this should mean that the syntax error comes up in the right place.
However, I don't plan to work on this (not soon, at least).
Steps To Reproduce
Expected Behavior
The error is reported on the second line.
Actual Behavior
Additional Information
No response
Environment
Checklist
The text was updated successfully, but these errors were encountered: