mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
Issue #14260: The groupindex attribute of regular expression pattern object
now is non-modifiable mapping.
This commit is contained in:
parent
1813c1701f
commit
07360df481
5 changed files with 31 additions and 5 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue