]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.9] gh-91700: Validate the group number in conditional expression in RE (GH-91702...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 22 Apr 2022 19:02:20 +0000 (12:02 -0700)
committerGitHub <noreply@github.com>
Fri, 22 Apr 2022 19:02:20 +0000 (22:02 +0300)
commit76ff68666fa946c44d16173ff52a127d3a9785db
tree37b978a79e94ef609f4ec560c2b897645b554ba6
parent97d14e1dfb9347bc8ef581055b2f70cd03e5f622
[3.9] gh-91700: Validate the group number in conditional expression in RE (GH-91702) (GH-91831) (GH-91836)

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.
(cherry picked from commit 48ec61a89a959071206549819448405c2cea61b0)
(cherry picked from commit 080781cd49b13da4a73db87b6f5e0c7aeec83e92)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/sre_parse.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]