Skip to content
Merged
Prev Previous commit
Next Next commit
Merge branch 'main' into re-group-name
  • Loading branch information
serhiy-storchaka committed Apr 23, 2022
commit 46f320db66f5a56224c74c8085e90091afcb268a
4 changes: 4 additions & 0 deletions Lib/re/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,10 @@ def _parse(source, state, verbose, nested, first=False):
if condgroup >= MAXGROUPS:
msg = "invalid group reference %d" % condgroup
raise source.error(msg, len(condname) + 1)
if condgroup not in state.grouprefpos:
state.grouprefpos[condgroup] = (
source.tell() - len(condname) - 1
)
else:
source.checkgroupname(condname, 1)
condgroup = state.groupdict.get(condname)
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.