summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-04-19 08:37:24 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-04-19 08:37:24 (GMT)
commit53d93adc46c73e6fdcd6db2d16f0136eadba9839 (patch)
tree748ba575bd069a881b92cdc60ed9d888e7cd3755 /Lib
parent910ae6283a2e715bd13962bd8e4da71c4fd3627d (diff)
downloadcpython-53d93adc46c73e6fdcd6db2d16f0136eadba9839.zip
cpython-53d93adc46c73e6fdcd6db2d16f0136eadba9839.tar.gz
cpython-53d93adc46c73e6fdcd6db2d16f0136eadba9839.tar.bz2
Patch #681152: Support escaped Unicode characters in classes. Fixes #612074.
Will backport to 2.2.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/sre_parse.py2
-rw-r--r--Lib/test/test_sre.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index fdf6767..b85aea7 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -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()
diff --git a/Lib/test/test_sre.py b/Lib/test/test_sre.py
index e4eb08d..db87162 100644
--- a/Lib/test/test_sre.py
+++ b/Lib/test/test_sre.py
@@ -96,6 +96,10 @@ test(r"""sre.match('.*?cd', 20000*'abc'+'de').end(0)""", 60001)
# non-simple '*?' still recurses and hits the recursion limit
test(r"""sre.search('(a|b)*?c', 10000*'ab'+'cd').end(0)""", None, RuntimeError)
+# 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'