]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patch #681152: Support escaped unicode characters in classes. Fixes 612074.
authorMartin v. Löwis <martin@v.loewis.de>
Sat, 19 Apr 2003 08:39:04 +0000 (08:39 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sat, 19 Apr 2003 08:39:04 +0000 (08:39 +0000)
Lib/sre_parse.py
Lib/test/test_sre.py

index f6b53de6ea2d34390732e1f0b881c9e0e169f518..555dc82b3b1cbabf3ca60d6b57dc7d3451e6e118 100644 (file)
@@ -254,7 +254,7 @@ def _class_escape(source, escape):
             if len(escape) != 2:
                 raise error, "bogus escape: %s" % repr("\\" + escape)
             return LITERAL, atoi(escape, 16) & 0xff
-        elif str(escape[1:2]) in OCTDIGITS:
+        elif escape[1:2] in OCTDIGITS:
             # octal escape (up to three digits)
             while source.next in OCTDIGITS and len(escape) < 5:
                 escape = escape + source.get()
index abd55db1d64d8ee344942fa5d314d645cbe27731..d4a052f651d1fc10d456373019477b5c4c4a3a46 100644 (file)
@@ -78,6 +78,10 @@ test(r"""sre.match(r'(a)|(b)', 'b').start(1)""", -1)
 test(r"""sre.match(r'(a)|(b)', 'b').end(1)""", -1)
 test(r"""sre.match(r'(a)|(b)', 'b').span(1)""", (-1, -1))
 
+# bug 612074
+pat=u"["+sre.escape(u"\u2039")+u"]"
+test(r"""sre.compile(pat) and 1""", 1, None)
+
 if verbose:
     print 'Running tests on sre.sub'