This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Dennis Sweeney, garylitvin, rhettinger, steven.daprano
Date 2021-02-07.07:39:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1612683576.68.0.478005888258.issue43151@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-02-07 07:39:36steven.dapranosetrecipients: + steven.daprano, rhettinger, Dennis Sweeney, garylitvin
2021-02-07 07:39:36steven.dapranosetmessageid: <1612683576.68.0.478005888258.issue43151@roundup.psfhosted.org>
2021-02-07 07:39:36steven.dapranolinkissue43151 messages
2021-02-07 07:39:36steven.dapranocreate