Terry J. Reedy <[email protected]> added the comment:
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.)
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue40807>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com