summaryrefslogtreecommitdiffstats
path: root/Lib/sre_parse.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-03-29 22:01:48 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-03-29 22:01:48 (GMT)
commit07360df481adeacfc2b7a1a7f89ae9a76e86b725 (patch)
tree1d111118cafc0117d3cd68fdfa7397e68dd25191 /Lib/sre_parse.py
parent1813c1701f8e7e9287bccf66d1b4b8348c432168 (diff)
downloadcpython-07360df481adeacfc2b7a1a7f89ae9a76e86b725.zip
cpython-07360df481adeacfc2b7a1a7f89ae9a76e86b725.tar.gz
cpython-07360df481adeacfc2b7a1a7f89ae9a76e86b725.tar.bz2
Issue #14260: The groupindex attribute of regular expression pattern object
now is non-modifiable mapping.
Diffstat (limited to 'Lib/sre_parse.py')
-rw-r--r--Lib/sre_parse.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/sre_parse.py b/Lib/sre_parse.py
index 0bce71e..c0f539d 100644
--- a/Lib/sre_parse.py
+++ b/Lib/sre_parse.py
@@ -855,6 +855,7 @@ def parse_template(source, pattern):
del literal[:]
groups.append((len(literals), index))
literals.append(None)
+ groupindex = pattern.groupindex
while True:
this = sget()
if this is None:
@@ -869,7 +870,7 @@ def parse_template(source, pattern):
name = s.getuntil(">")
if name.isidentifier():
try:
- index = pattern.groupindex[name]
+ index = groupindex[name]
except KeyError:
raise IndexError("unknown group name %r" % name)
else: