diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-07-18 20:27:00 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-07-18 20:27:00 (GMT) |
commit | 485407ce1e4dc3b2005bc1c72ce6020c28f90030 (patch) | |
tree | 8082f5971a787e457c46b85c17030b53e4b13a46 /Lib/sre_parse.py | |
parent | 2489bd5d4e45b2a1d90f9336bf528ab1bba2d796 (diff) | |
download | cpython-485407ce1e4dc3b2005bc1c72ce6020c28f90030.zip cpython-485407ce1e4dc3b2005bc1c72ce6020c28f90030.tar.gz cpython-485407ce1e4dc3b2005bc1c72ce6020c28f90030.tar.bz2 |
Issue #24580: Symbolic group references to open group in re patterns now are
explicitly forbidden as well as numeric group references.
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r-- | Lib/sre_parse.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py index c0f539d..67f84e9 100644 --- a/Lib/sre_parse.py +++ b/Lib/sre_parse.py @@ -675,6 +675,9 @@ def _parse(source, state): if gid is None: msg = "unknown group name %r" % name raise source.error(msg, len(name) + 1) + if not state.checkgroup(gid): + raise source.error("cannot refer to an open group", + len(name) + 1) state.checklookbehindgroup(gid, source) subpatternappend((GROUPREF, gid)) continue |