Message334366
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. |
|
Date |
User |
Action |
Args |
2019-01-25 20:35:09 | terry.reedy | set | recipients:
+ terry.reedy, vstinner, jwilk, serhiy.storchaka, kakshay |
2019-01-25 20:35:08 | terry.reedy | set | messageid: <1548448508.21.0.170421895943.issue35798@roundup.psfhosted.org> |
2019-01-25 20:35:08 | terry.reedy | link | issue35798 messages |
2019-01-25 20:35:08 | terry.reedy | create | |
|