Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Python 3.11re.compile raises SRE code error for valid regex. #98740

Closed
Labels
3.10only security fixes3.11only security fixes3.12only security fixestopic-regextype-bugAn unexpected behavior, bug, or error
@Waszker

Description

@Waszker

Bug report

Following regex causesre.compile() to raiseRuntimeError: 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 toolhttps://regex101.com/

I've already asked about this onmailing list and confirmed that this is a bug.

@serhiy-storchaka has confirmed that the case for this bug has already been found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.10only security fixes3.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


      [8]ページ先頭

      ©2009-2025 Movatter.jp