◐ Shell
clean mode source ↗

Message 370751 - Python tracker

This is a spinoff of #37824.

My above comments about compile are wrong.  The example nests '' within ''.  And, with freshly compiled master, I found an example where Deprecation warning, but not SyntaxWarning, accompanies SyntaxError, and which requires trailing \n.

>>> compile("if'\e' is 1: 1", '', 'single')
DeprecationWarning...
SyntaxError: unexpected EOF while parsing
>>> compile("if'\e' is 1: 1\n", '', 'single')
DeprecationWarning...
SyntaxWarning...
<code object ...>

Interactively,
>>> if'\e' is 1: 1
<stdin>:1: DeprecationWarning: invalid escape sequence \e
... 
<stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
>>>

In IDLE, DeprecationWarning is repeated, but that is another issue.

The secondary prompts seems like a bug,  The statement is complete and entering anything but a comment is a SyntaxError.  (A comment results in another ... prompt.)