summaryrefslogtreecommitdiffstats
path: root/Modules
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 /Modules
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 'Modules')
-rw-r--r--Modules/_sre/sre_lib.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_sre/sre_lib.h b/Modules/_sre/sre_lib.h
index fb4c18b..e831498 100644
--- a/Modules/_sre/sre_lib.h
+++ b/Modules/_sre/sre_lib.h
@@ -1334,6 +1334,10 @@ dispatch:
MARK_POP(ctx->lastmark);
LASTMARK_RESTORE();
+ /* Restore the global Input Stream pointer
+ since it can change after jumps. */
+ state->ptr = ptr;
+
/* We have sufficient matches, so exit loop. */
break;
}