Issue #28727: Optimize pattern_richcompare() for a==a

A pattern is equal to itself.
This commit is contained in:
Victor Stinner 2016-11-22 15:30:38 +01:00
parent e670b2d5c3
commit bcf4dccfa7
2 changed files with 10 additions and 0 deletions

View file

@ -1781,6 +1781,10 @@ SUBPATTERN None 0 0
def test_pattern_compare(self):
pattern1 = re.compile('abc', re.IGNORECASE)
# equal to itself
self.assertEqual(pattern1, pattern1)
self.assertFalse(pattern1 != pattern1)
# equal
re.purge()
pattern2 = re.compile('abc', re.IGNORECASE)