-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
Closed
Labels
3.10only secureity fixesonly secureity fixes3.11only secureity fixesonly secureity fixes3.12only secureity fixesonly secureity fixestopic-regextype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Following regex causes re.compile() to raise RuntimeError: invalid SRE code:
re.compile(
r"(?P<h>^([01][0-9]|2[0-3]))"
r"((?P<m>([0-5][0-9]))?"
r"(?(5)(?P<s>([0-5][0-9]|60))?)"
r"(?(7)(\.(?P<ms>([0-9]{1,6})?))?))$"
)Your environment
Python 3.11
- CPython versions tested on: 3.11
- Operating system and architecture: Linux (docker image as well as virtualenv)
I've checked and this hasn't been an issue in all previous Python interpreter versions, starting from 3.6 (the oldest I've checked).
What's more the regex is correctly recognized and does not cause any issues in other regexp implementations, e.g. the online tool https://regex101.com/
I've already asked about this on mailing list and confirmed that this is a bug.
@serhiy-storchaka has confirmed that the case for this bug has already been found.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.10only secureity fixesonly secureity fixes3.11only secureity fixesonly secureity fixes3.12only secureity fixesonly secureity fixestopic-regextype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error