summaryrefslogtreecommitdiffstats
path: root/Lib/re/_compiler.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2023-08-16 10:00:55 (GMT)
committerGitHub <noreply@github.com>2023-08-16 10:00:55 (GMT)
commitbd2ef82a5010985abdeef2ca71bcbcc9a366993b (patch)
tree8c8195fa20e743c40c6c6b0627f4e84384d5678e /Lib/re/_compiler.py
parent00bfed7cba3f2d66a1534f9f088ddf68abbf0d3f (diff)
downloadcpython-bd2ef82a5010985abdeef2ca71bcbcc9a366993b.zip
cpython-bd2ef82a5010985abdeef2ca71bcbcc9a366993b.tar.gz
cpython-bd2ef82a5010985abdeef2ca71bcbcc9a366993b.tar.bz2
[3.12] gh-100061: Proper fix of the bug in the matching of possessive quantifiers (GH-102612) (#108003)
Restore the global Input Stream pointer after trying to match a sub-pattern. . (cherry picked from commit abd9cc52d94b8e2835322b62c29f09bb0e6fcfe9) Co-authored-by: SKO <41810398+uyw4687@users.noreply.github.com>
Diffstat (limited to 'Lib/re/_compiler.py')
-rw-r--r--Lib/re/_compiler.py7
1 files changed, 0 insertions, 7 deletions
diff --git a/Lib/re/_compiler.py b/Lib/re/_compiler.py
index e30740b..d8e0d2f 100644
--- a/Lib/re/_compiler.py
+++ b/Lib/re/_compiler.py
@@ -100,13 +100,6 @@ def _compile(code, pattern, flags):
emit(ANY_ALL)
else:
emit(ANY)
- elif op is POSSESSIVE_REPEAT:
- # gh-106052: Possessive quantifiers do not work when the
- # subpattern contains backtracking, i.e. "(?:ab?c)*+".
- # Implement it as equivalent greedy qualifier in atomic group.
- p = [(MAX_REPEAT, av)]
- p = [(ATOMIC_GROUP, p)]
- _compile(code, p, flags)
elif op in REPEATING_CODES:
if flags & SRE_FLAG_TEMPLATE:
raise error("internal: unsupported template operator %r" % (op,))