[New-bugs-announce] [issue35861] test_named_expressions raises SyntaxWarning

Karthikeyan Singaravelan report at bugs.python.org
Wed Jan 30 14:05:31 EST 2019


New submission from Karthikeyan Singaravelan <tir.karthi at gmail.com>:

SyntaxWarning was recently added for comparison using "is" over literals with issue34850. This is raised on master for a PEP 572 related test. The warning is emitted twice which is covered with bpo-35798 and I verified the patch. The fix for this issue would be to use == as noted in the warning. 

Emily, if you can confirm my report then I would like to triage this as an easy one since the fix is simple.

# SyntaxWarning on master

➜  cpython git:(master) ./python.exe Lib/test/test_named_expressions.py
Lib/test/test_named_expressions.py:168: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if (match := 10) is 10:
Lib/test/test_named_expressions.py:168: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if (match := 10) is 10:
........................................................
----------------------------------------------------------------------
Ran 56 tests in 0.010s

OK


Thanks

----------
components: Tests
messages: 334587
nosy: emilyemorehouse, serhiy.storchaka, xtreak
priority: normal
severity: normal
status: open
title: test_named_expressions raises SyntaxWarning
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35861>
_______________________________________


More information about the New-bugs-announce mailing list