-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Possessive quantifier matches where an ordinary quantifier doesn't #106052
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
Comments
If nothing else, the docs claim that
And, >>> import re
>>> re.fullmatch('(?>(?:ab?c)*)', 'a')
>>> So, that seems a clear discrepancy. |
@ezio-melotti, @serhiy-storchaka (as re module experts) |
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. |
It did not work in the case of a subpattern containing backtraces. Temporary implement possessive quantifiers as equivalent greedy qualifiers in atomic groups.
It did not work in the case of a subpattern containing backtraces. Temporary implement possessive quantifiers as equivalent greedy qualifiers in atomic groups.
It did not work in the case of a subpattern containing backtraces. Temporary implement possessive quantifiers as equivalent greedy qualifiers in atomic groups.
It did not work in the case of a subpattern containing backtracking. Temporary implement possessive quantifiers as equivalent greedy qualifiers in atomic groups.
#106515 is a last resort. It should be merged if better solution not be found before the next releases. |
FYI, per comments in #106515, I'm not treating this as a release blocker in 3.12 beta 4. |
(per comment on the PR, I don't think this is really a release blocker given the bug shipped in 3.11) |
It did not work in the case of a subpattern containing backtracking. Temporary implement possessive quantifiers as equivalent greedy qualifiers in atomic groups.
…iers (pythongh-106515) It did not work in the case of a subpattern containing backtracking. Temporary implement possessive quantifiers as equivalent greedy qualifiers in atomic groups.. (cherry picked from commit 7b6e34e) Co-authored-by: Serhiy Storchaka <[email protected]>
…iers (pythongh-106515) It did not work in the case of a subpattern containing backtracking. Temporary implement possessive quantifiers as equivalent greedy qualifiers in atomic groups.. (cherry picked from commit 7b6e34e) Co-authored-by: Serhiy Storchaka <[email protected]>
It is actually a duplicate of #100061 for which there is a proper fix. |
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 thenR*+
shouldn't match it, whereR
is any regex.Versions tested:
Linked PRs
The text was updated successfully, but these errors were encountered: