diff options
author | Guido van Rossum <guido@python.org> | 2003-04-14 17:59:34 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-04-14 17:59:34 +0000 |
commit | eba2fea90a07373ee600e7f28ba28a87e6b17a2e (patch) | |
tree | 8014128f1fbbc27cd7263ea023013869b189e457 /Lib/sre_parse.py | |
parent | 5e45f88b8df121fe3b61f1ab8c91e8d92032728b (diff) | |
download | cpython-eba2fea90a07373ee600e7f28ba28a87e6b17a2e.tar.gz |
SF patch #720991 by Gary Herron:
A small fix for bug #545855 and Greg Chapman's
addition of op code SRE_OP_MIN_REPEAT_ONE for
eliminating recursion on simple uses of pattern '*?' on a
long string.
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 1b52967a58..fdf6767367 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] |