]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-91700: Validate the group number in conditional expression in RE (GH-91702)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 22 Apr 2022 16:53:10 +0000 (19:53 +0300)
committerGitHub <noreply@github.com>
Fri, 22 Apr 2022 16:53:10 +0000 (19:53 +0300)
commit48ec61a89a959071206549819448405c2cea61b0
tree56c7d8341d6c617c516e1a3746d724eb9f67d8c8
parent6ccfa31421393910b52936e0447625db06f2a655
gh-91700: Validate the group number in conditional expression in RE (GH-91702)

In expression (?(group)...) an appropriate re.error is now
raised if the group number refers to not defined group.

Previously it raised RuntimeError: invalid SRE code.
Lib/re/_parser.py
Lib/test/test_re.py
Misc/NEWS.d/next/Library/2022-04-19-17-30-17.gh-issue-91700.MRJi6m.rst [new file with mode: 0644]