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 vstinner
Recipients vstinner
Date 2016-11-17.16:02:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Attached patch implements rich comparison for _sre.SRE_Pattern objects created by re.compile().

Comparison between patterns is used in the warnings module to not add duplicated filters, see issue #18383:

New changeset f57f4e33ba5e by Martin Panter in branch '3.5':
Issue #18383: Avoid adding duplicate filters when warnings is reloaded

For the warnings module, it became a problem in test_warnings since the Python test runner started to clear all caches. When re.purge() is called, re.compile() creates a new object, whereas with the cache it returns the same object and so the two patterns are equal since it's the same object. => see issue #28688
Date User Action Args
2016-11-17 16:02:48vstinnersetrecipients: + vstinner
2016-11-17 16:02:48vstinnersetmessageid: <>
2016-11-17 16:02:48vstinnerlinkissue28727 messages
2016-11-17 16:02:47vstinnercreate