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.

classification
Title: test_named_expressions raises SyntaxWarning
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: xtreak Nosy List: emilyemorehouse, serhiy.storchaka, xtreak
Priority: normal Keywords: easy, patch, patch, patch

Created on 2019-01-30 19:05 by xtreak, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11722 merged nanjekyejoannah, 2019-02-01 12:42
PR 11722 merged nanjekyejoannah, 2019-02-01 12:42
PR 11722 merged nanjekyejoannah, 2019-02-01 12:42
Messages (4)
msg334587 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-01-30 19:05
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
msg334599 - (view) Author: Emily Morehouse (emilyemorehouse) * (Python committer) Date: 2019-01-30 22:40
Yes, you're exactly correct! Feel free to submit a PR and add me as a reviewer when you're ready.
msg334604 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-01-31 05:33
Thanks Emily, I am marking this as easy since it's related to tests and doesn't affect alpha release. If no one gets to this I will raise a fix for this by Sunday.
msg334715 - (view) Author: Emily Morehouse (emilyemorehouse) * (Python committer) Date: 2019-02-01 19:58
New changeset 075de6cf6cb0f5f4d3711fc07f023a9a7a0a816b by Emily Morehouse (Joannah Nanjekye) in branch 'master':
bpo-35861: Fix SyntaxWarning in test_named_expressions.py (GH-11722)
https://github.com/python/cpython/commit/075de6cf6cb0f5f4d3711fc07f023a9a7a0a816b
History
Date User Action Args
2022-04-11 14:59:10adminsetgithub: 80042
2019-02-01 21:54:26emilyemorehousesetkeywords: patch, patch, patch, easy
status: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-02-01 19:58:47emilyemorehousesetmessages: + msg334715
2019-02-01 12:43:06nanjekyejoannahsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request11600
2019-02-01 12:42:58nanjekyejoannahsetkeywords: + patch
stage: needs patch -> needs patch
pull_requests: + pull_request11599
2019-02-01 12:42:50nanjekyejoannahsetkeywords: + patch
stage: needs patch -> needs patch
pull_requests: + pull_request11598
2019-01-31 05:33:56xtreaksetkeywords: + easy

messages: + msg334604
2019-01-30 22:40:08emilyemorehousesetassignee: xtreak
messages: + msg334599
stage: needs patch
2019-01-30 19:05:31xtreakcreate