diff options
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index 1b52967..fdf6767 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -419,7 +419,7 @@ def _parse(source, state): set.append(code1) set.append((LITERAL, ord("-"))) break - else: + elif this: if this[0] == "\\": code2 = _class_escape(source, this) else: @@ -431,6 +431,8 @@ def _parse(source, state): if hi < lo: raise error, "bad character range" set.append((RANGE, (lo, hi))) + else: + raise error, "unexpected end of regular expression" else: if code1[0] is IN: code1 = code1[1][0] |