Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:

Gary, I cannot replicate that inconsistency in 3.9.0.


>>> x = "abc"
>>> x is "abc"
<stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
True
>>> if x is "abc": pass
... 
<stdin>:1: SyntaxWarning: "is" with a literal. Did you mean "=="?


I don't believe that you should be getting a SyntaxError at all, and both cases 
should give the same warning. Can you double-check your code, and if you 
confirm that they give a different result or a SyntaxError, let us know here. 
Otherwise Raymond and Dennis are correct: this is working correctly.

----------
nosy: +steven.daprano

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43151>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to