]> granicus.if.org Git - python/commitdiff
SF #926075: Fixed the bug that returns a wrong pattern object for
authorHye-Shik Chang <hyeshik@gmail.com>
Tue, 20 Apr 2004 21:30:07 +0000 (21:30 +0000)
committerHye-Shik Chang <hyeshik@gmail.com>
Tue, 20 Apr 2004 21:30:07 +0000 (21:30 +0000)
a string or unicode object in sre.compile() when a different type
pattern with the same value exists.

Lib/test/test_re.py

index 6ceab6de3bca467bcdb114a9b51c0d238b4e6457..9edca6eb9701afb9cf1e456b97cca427afa75659 100644 (file)
@@ -489,6 +489,14 @@ class ReTests(unittest.TestCase):
         self.assertEqual([item.group(0) for item in iter],
                          [":", "::", ":::"])
 
+    def test_bug_926075(self):
+        try:
+            unicode
+        except NameError:
+            return # no problem if we have no unicode
+        self.assert_(re.compile('bug_926075') is not
+                     re.compile(eval("u'bug_926075'")))
+
 def run_re_tests():
     from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR
     if verbose: