mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
[3.13] gh-101955: Fix SystemError in possesive quantifier with alternative and group (GH-111362) (GH-126962)
(cherry picked from commit f9c5573ded
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
885386b4a2
commit
c2c18acc3d
3 changed files with 26 additions and 0 deletions
|
@ -2641,6 +2641,12 @@ class ReTests(unittest.TestCase):
|
|||
self.assertEqual(re.match("(?>(?:ab?c){1,3})", "aca").span(), (0, 2))
|
||||
self.assertEqual(re.match("(?:ab?c){1,3}+", "aca").span(), (0, 2))
|
||||
|
||||
def test_bug_gh101955(self):
|
||||
# Possessive quantifier with nested alternative with capture groups
|
||||
self.assertEqual(re.match('((x)|y|z)*+', 'xyz').groups(), ('z', 'x'))
|
||||
self.assertEqual(re.match('((x)|y|z){3}+', 'xyz').groups(), ('z', 'x'))
|
||||
self.assertEqual(re.match('((x)|y|z){3,}+', 'xyz').groups(), ('z', 'x'))
|
||||
|
||||
@unittest.skipIf(multiprocessing is None, 'test requires multiprocessing')
|
||||
def test_regression_gh94675(self):
|
||||
pattern = re.compile(r'(?<=[({}])(((//[^\n]*)?[\n])([\000-\040])*)*'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue