Preparser not working if cell starts with a comment
Some of my code stopped working after I upgraded from version 9.0 to 9.3beta4. I tracked it to the following bug:
sage: preparse('1 # Comment \n 1.5^2')
"Integer(1) # Comment \n RealNumber('1.5')**Integer(2)"
sage: preparse('# Comment \n 1.5^2')
'# Comment \n 1.5^2'
The code is not getting preparsed if it starts with a comment. In practice it looks like this:
This seems like a big issue, and I would be surprised if it went unnoticed until now. Could it be caused by my Sage installation? (Compiled from source on WSL2 Ubuntu 20.04, which is not officially supported, but I didn't notice anything weird).
Can someone try this?
I confirm the issue with Sage 9.3.beta4. With Sage 9.2, the bug appears only the console: everything is fine in the Jupyter notebook.
Thanks Eric for the quick reply. The same is true for Sage 9.0. I wonder what changed, and how was it working previously.
Looking at the code for
preparse
, it starts withThat code has been there since at least 2014, and perfectly explains the first observation. An easy fix would probably be to check here for a line break, but that doesn't explain why it was working before.