diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-03 20:33:38 +0200 |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2012-11-03 20:33:38 +0200 |
commit | 68600aff3a841c1d901758c0e4e3fb3aafc7354e (patch) | |
tree | d806de6795b875139e568664913709b24e11e4f1 /Lib/sre_parse.py | |
parent | befaac03bbf7bdc8e34f722072931c2e4a2408b5 (diff) | |
parent | 0941d9fc64e1429454282667d0ca47740c141943 (diff) | |
download | cpython-git-68600aff3a841c1d901758c0e4e3fb3aafc7354e.tar.gz |
#12759: merge with 3.2.
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index d358646a39..6411475ac2 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -580,6 +580,8 @@ def _parse(source, state): break name = name + char group = 1 + if not name: + raise error("missing group name") if not isname(name): raise error("bad character in group name") elif sourcematch("="): @@ -592,6 +594,8 @@ def _parse(source, state): if char == ")": break name = name + char + if not name: + raise error("missing group name") if not isname(name): raise error("bad character in group name") gid = state.groupdict.get(name) @@ -644,6 +648,8 @@ def _parse(source, state): break condname = condname + char group = 2 + if not condname: + raise error("missing group name") if isname(condname): condgroup = state.groupdict.get(condname) if condgroup is None: @@ -775,7 +781,7 @@ def parse_template(source, pattern): break name = name + char if not name: - raise error("bad group name") + raise error("missing group name") try: index = int(name) if index < 0: |