Skip to content

SystemError in re.match with a "*+" pattern #101955

Closed
@aryla

Description

@aryla

Bug report

The following code raises a SystemError.

import re
re.match('((x)|y|z)*+', 'xyz')

Error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Arttu\AppData\Local\Programs\Python\Python311\Lib\re\__init__.py", line 166, in match
    return _compile(pattern, flags).match(string)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SystemError: The span of capturing group is wrong, please report a bug for the re module.

((x)|y|z)++ gives the same error but (?>((x)|y|z)*) does not.

Your environment

Python 3.11.2 (tags/v3.11.2:878ead1, Feb 7 2023, 16:38:35) [MSC v.1934 64 bit (AMD64)] on win32

Linked PRs

Metadata

Metadata

Labels

3.11only security fixes3.12only security fixestopic-regextype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions