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 terry.reedy
Recipients jwilk, kakshay, serhiy.storchaka, terry.reedy, vstinner
Date 2019-01-25.20:35:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1548448508.21.0.170421895943.issue35798@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-01-25 20:35:09terry.reedysetrecipients: + terry.reedy, vstinner, jwilk, serhiy.storchaka, kakshay
2019-01-25 20:35:08terry.reedysetmessageid: <1548448508.21.0.170421895943.issue35798@roundup.psfhosted.org>
2019-01-25 20:35:08terry.reedylinkissue35798 messages
2019-01-25 20:35:08terry.reedycreate