GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Possessive quantifier matches where an ordinary quantifier doesn't · Issue #106052 · python/cpython

Possessive quantifier matches where an ordinary quantifier doesn't #106052

New issue
Copy link
New issue
Copy link
Closed
Closed
Possessive quantifier matches where an ordinary quantifier doesn't#106052
Copy link
Assignees
serhiy-storchaka
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixestopic-regextype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@benrg
benrg
opened on Jun 24, 2023
Issue body actions
>>> import re
>>> re.fullmatch('(?:ab?c)*', 'a')
>>> re.fullmatch('(?:ab?c)*+', 'a')
<re.Match object; span=(0, 1), match='a'>
>>>

I'm not sure that I completely understand the behavior of the possessive quantifiers, but I think that if R* doesn't match a string then R*+ shouldn't match it, where R is any regex.

Versions tested:

3.12.0b3 (tags/v3.12.0b3:f992a60, Jun 20 2023, 12:25:40) [MSC v.1936 64 bit (AMD64)]
3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:30:09) [MSC v.1934 32 bit (Intel)]
3.11.4 (main, Jun 14 2023, 18:33:43) [GCC 10.2.1 20210110]

Linked PRs

  • gh-106052: Fix bug in the matching of possessive quantifiers #106515
  • [3.11] gh-106052: Fix bug in the matching of possessive quantifiers (gh-106515) #107795
  • [3.12] gh-106052: Fix bug in the matching of possessive quantifiers (GH-106515) #107796
Reacted by Frank Dana

Activity

  1. benrg
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jun 24, 2023
  2. AlexWaygood
    added
    topic-regex
    on Jun 24, 2023
  3. ferdnyc commented on Jun 24, 2023

    @ferdnyc
    ferdnyc
    on Jun 24, 2023
    Contributor
    More actions

    If nothing else, the docs claim that

    x*+, x++ and x?+ are equivalent to (?>x*), (?>x+) and (?>x?) correspondingly.

    And,

    >>> import re
    >>> re.fullmatch('(?>(?:ab?c)*)', 'a')
    >>> 

    So, that seems a clear discrepancy.

  4. arhadthedev commented on Jun 24, 2023

    @arhadthedev
    arhadthedev
    on Jun 24, 2023
    Member
    More actions

    @ezio-melotti, @serhiy-storchaka (as re module experts)

  5. serhiy-storchaka
    self-assigned this
    on Jun 24, 2023
  6. serhiy-storchaka commented on Jul 7, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Jul 7, 2023
    Member
    More actions

    It is definitely a bug.

    The simplest fix would be implementing possessive quantifiers via atomic groups. It may be less efficient, but gives us time to fix the specialized opcode.

  7. serhiy-storchaka
    added 2 commits that reference this issue on Jul 7, 2023

    pythongh-106052: Fix bug in the matching of possessive quantifiers

    4374d46

    pythongh-106052: Fix bug in the matching of possessive quantifiers

    d73d88e
  8. serhiy-storchaka
    added
    3.11only security fixesonly security fixes
    3.12only security fixesonly security fixes
    3.13only security fixesonly security fixes
    on Jul 7, 2023
  9. serhiy-storchaka
    added 2 commits that reference this issue on Jul 7, 2023

    pythongh-106052: Fix bug in the matching of possessive quantifiers

    1a420c0

    pythongh-106052: Fix bug in the matching of possessive quantifiers

    89bf9dc
  10. serhiy-storchaka
    added
    release-blocker
    on Jul 10, 2023
  11. ezio-melotti
    added this to Release and Deferred blockers 🚫on Jul 10, 2023
  12. github-project-automation
    moved this to Todo in Release and Deferred blockers 🚫on Jul 10, 2023
  13. serhiy-storchaka commented on Jul 10, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Jul 10, 2023
    Member
    More actions

    #106515 is a last resort. It should be merged if better solution not be found before the next releases.

    Reacted by Frank Dana
  14. Yhg1s commented on Jul 11, 2023

    @Yhg1s
    Yhg1s
    on Jul 11, 2023
    Member
    More actions

    FYI, per comments in #106515, I'm not treating this as a release blocker in 3.12 beta 4.

  15. gpshead commented on Jul 26, 2023

    @gpshead
    gpshead
    on Jul 26, 2023
    Member
    More actions

    (per comment on the PR, I don't think this is really a release blocker given the bug shipped in 3.11)

  16. gpshead
    added
    deferred-blocker
    and removed
    release-blocker
    on Jul 26, 2023
  17. serhiy-storchaka
    added 4 commits that reference this issue on Aug 9, 2023

    gh-106052: Fix bug in the matching of possessive quantifiers (gh-106515)

    7b6e34e

    [3.11] pythongh-106052: Fix bug in the matching of possessive quantif…

    d9686c0

    [3.12] pythongh-106052: Fix bug in the matching of possessive quantif…

    bfcee6c

    [3.11] gh-106052: Fix bug in the matching of possessive quantifiers (G…

    5b76eaf
  18. Yhg1s
    added a commit that references this issue on Aug 9, 2023

    [3.12] gh-106052: Fix bug in the matching of possessive quantifiers (G…

    3bb43b7
  19. serhiy-storchaka
    removed
    deferred-blocker
    on Aug 9, 2023
  20. serhiy-storchaka commented on Aug 16, 2023

    @serhiy-storchaka
    serhiy-storchaka
    on Aug 16, 2023
    Member
    More actions

    It is actually a duplicate of #100061 for which there is a proper fix.

  21. serhiy-storchaka
    closed this as completedon Aug 16, 2023
  22. github-project-automation
    moved this from Todo to Done in Release and Deferred blockers 🚫on Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @serhiy-storchaka
    serhiy-storchaka

Labels

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

Projects

  • Release and Deferred blockers 🚫
    Status
    Done
    Show more project fields

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.