From 025468d246cda4f9e7da098ea615e56a5f8f7f46 Mon Sep 17 00:00:00 2001 From: Fredrik Lundh Date: Sat, 7 Oct 2000 10:16:19 +0000 Subject: [PATCH] SRE didn't handle character category followed by hyphen inside a character class. Fix provided by Andrew Kuchling. Closes bug #116251. --- Lib/sre_parse.py | 2 ++ Lib/test/re_tests.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index fcf5bcc9fd0..9cbbc0254e8 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -393,6 +393,8 @@ def _parse(source, state): # potential range this = source.get() if this == "]": + if code1[0] is IN: + code1 = code1[1][0] set.append(code1) set.append((LITERAL, ord("-"))) break diff --git a/Lib/test/re_tests.py b/Lib/test/re_tests.py index 86752244b78..7c541752f28 100755 --- a/Lib/test/re_tests.py +++ b/Lib/test/re_tests.py @@ -619,4 +619,6 @@ xyzabc (r' (?x)foo ', 'foo', SUCCEED, 'found', 'foo'), # bug 115618: negative lookahead (r'(?