Issue35798
Created on 2019-01-21 15:13 by jwilk, last changed 2019-02-19 06:48 by serhiy.storchaka. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 11639 | merged | serhiy.storchaka, 2019-01-21 19:06 | |
| PR 11639 | merged | serhiy.storchaka, 2019-01-21 19:06 | |
| PR 11639 | merged | serhiy.storchaka, 2019-01-21 19:06 | |
| PR 11642 | closed | kakshay, 2019-01-21 21:14 | |
| PR 11642 | closed | kakshay, 2019-01-21 21:14 | |
| PR 11642 | closed | kakshay, 2019-01-21 21:14 | |
| PR 11895 | merged | serhiy.storchaka, 2019-02-16 13:26 | |
| Messages (7) | |||
|---|---|---|---|
| msg334143 - (view) | Author: Jakub Wilk (jwilk) | Date: 2019-01-21 15:13 | |
$ python3.8 -c 'if object() is 42: pass' <string>:1: SyntaxWarning: "is" with a literal. Did you mean "=="? <string>:1: SyntaxWarning: "is" with a literal. Did you mean "=="? I'd like only one copy of this warning, not two. Tested with git master (e9b185f2a493cc54f0d49eac44bf21e8d7de2990). |
|||
| msg334144 - (view) | Author: STINNER Victor (vstinner) * | Date: 2019-01-21 15:18 | |
The warning has been introduced by bpo-34850: commit 3bcbedc9f1471d957a30a90f9d1251516b422416. |
|||
| msg334169 - (view) | Author: Kumar Akshay (kakshay) * | Date: 2019-01-21 19:41 | |
can I work on this? |
|||
| msg334366 - (view) | Author: Terry J. Reedy (terry.reedy) * | Date: 2019-01-25 20:35 | |
I verified that master on Windows (which requires " instead of ') > python -c "if object() is 42: pass" results in the doubled messsage, and that after applying PR 11639 and recompiling, there is only 1 message. We should test that exactly 1 warning is emitted. The following fails on master and passes with the parch: import unittest, warnings class SyntaxWarningTest(unittest.TestCase): def test_syntax_warning_once(self): with warnings.catch_warnings(record=True) as w: warnings.simplefilter("always") compile('if object() is 42: pass\n', '', 'single') self.assertEqual(len(w), 1) # Not 2, see issue 35798 if __name__ == '__main__': unittest.main() The original patch added test_comparison_is_literal() in test_grammar. The 'with' block above could be added at the end. |
|||
| msg335670 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-02-16 06:29 | |
This warning is not special. I'll add a helper for testing that all syntax warnings are emitted only once later. |
|||
| msg335671 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-02-16 06:29 | |
New changeset 4583525835baf8fc7bd49a60725d1e8c49ef92b3 by Serhiy Storchaka in branch 'master': bpo-35798: Fix duplicate SyntaxWarning: "is" with a literal. (GH-11639) https://github.com/python/cpython/commit/4583525835baf8fc7bd49a60725d1e8c49ef92b3 |
|||
| msg335891 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2019-02-19 06:30 | |
New changeset e7a4bb554edb72fc6619d23241d59162d06f249a by Serhiy Storchaka in branch 'master': bpo-35798: Add test.support.check_syntax_warning(). (#11895) https://github.com/python/cpython/commit/e7a4bb554edb72fc6619d23241d59162d06f249a |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-02-19 06:48:16 | serhiy.storchaka | set | keywords:
patch, patch, patch status: pending -> closed |
| 2019-02-19 06:48:00 | serhiy.storchaka | set | keywords:
patch, patch, patch status: open -> pending resolution: fixed stage: patch review -> resolved |
| 2019-02-19 06:30:19 | serhiy.storchaka | set | messages: + msg335891 |
| 2019-02-16 13:26:06 | serhiy.storchaka | set | pull_requests: + pull_request11922 |
| 2019-02-16 06:29:48 | serhiy.storchaka | set | messages: + msg335671 |
| 2019-02-16 06:29:30 | serhiy.storchaka | set | keywords:
patch, patch, patch messages: + msg335670 |
| 2019-01-25 20:35:08 | terry.reedy | set | keywords:
patch, patch, patch nosy: + terry.reedy messages: + msg334366 |
| 2019-01-21 21:14:21 | kakshay | set | pull_requests: + pull_request11421 |
| 2019-01-21 21:14:13 | kakshay | set | pull_requests: + pull_request11420 |
| 2019-01-21 21:14:04 | kakshay | set | pull_requests: + pull_request11419 |
| 2019-01-21 19:41:38 | kakshay | set | nosy:
+ kakshay messages: + msg334169 |
| 2019-01-21 19:06:34 | serhiy.storchaka | set | keywords:
+ patch stage: patch review pull_requests: + pull_request11412 |
| 2019-01-21 19:06:29 | serhiy.storchaka | set | keywords:
+ patch stage: (no value) pull_requests: + pull_request11411 |
| 2019-01-21 19:06:24 | serhiy.storchaka | set | keywords:
+ patch stage: (no value) pull_requests: + pull_request11410 |
| 2019-01-21 15:18:50 | vstinner | set | nosy:
+ vstinner messages: + msg334144 |
| 2019-01-21 15:13:45 | jwilk | create | |