Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
aryla opened this issue Feb 16, 2023 · 5 comments
Closed

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

aryla opened this issue Feb 16, 2023 · 5 comments
Assignees
Labels
3.11 only security fixes 3.12 bugs and security fixes topic-regex type-bug An unexpected behavior, bug, or error

Comments

@aryla
Copy link

aryla commented Feb 16, 2023

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

@aryla aryla added the type-bug An unexpected behavior, bug, or error label Feb 16, 2023
@AlexWaygood AlexWaygood added topic-regex 3.11 only security fixes labels Feb 16, 2023
@ghost
Copy link

ghost commented Feb 24, 2023

Should set state->repeat to non-NULL in SRE_OP_POSSESSIVE_REPEAT opcode.

@uyw4687
Copy link
Contributor

uyw4687 commented Mar 6, 2023

I'll look into it

@corona10 corona10 added the 3.12 bugs and security fixes label Mar 6, 2023
@corona10
Copy link
Member

corona10 commented Mar 6, 2023

I'll look into it

Please go a head

@ghost
Copy link

ghost commented Mar 6, 2023

I'll look into it

If you don't know much about sre (no offence), it's easier to start with this issue: #100061

@serhiy-storchaka serhiy-storchaka self-assigned this Aug 26, 2023
serhiy-storchaka added a commit to serhiy-storchaka/cpython that referenced this issue Oct 26, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 18, 2024
…tive and group (pythonGH-111362)

(cherry picked from commit f9c5573)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Nov 18, 2024
…tive and group (pythonGH-111362)

(cherry picked from commit f9c5573)

Co-authored-by: Serhiy Storchaka <[email protected]>
Co-authored-by: <[email protected]>
@serhiy-storchaka
Copy link
Member

Thanks @wjssz. The final code is his contribution.

serhiy-storchaka added a commit that referenced this issue Nov 18, 2024
…ative and group (GH-111362) (GH-126963)

(cherry picked from commit f9c5573)

Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka added a commit that referenced this issue Nov 18, 2024
…ative and group (GH-111362) (GH-126962)

(cherry picked from commit f9c5573)

Co-authored-by: Serhiy Storchaka <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes topic-regex type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

5 participants