Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
gh-100061 Restore the global Input Stream pointer
  • Loading branch information
uyw4687 committed Mar 11, 2023
commit 007e7d749bb0f3f289920666e5f894735316a8a8
2 changes: 2 additions & 0 deletions Lib/test/test_re.py
Original file line number Diff line number Diff line change
Expand Up @@ -2303,6 +2303,8 @@ def test_possessive_quantifiers(self):
self.assertIsNone(re.match("^x{}+$", "xxx"))
self.assertTrue(re.match("^x{}+$", "x{}"))

self.assertEqual(re.match('((.(?!C))++)', 'ABCD').span(), (0, 1))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may add a comment # gh-100061 for this test-case.

Copy link
Copy Markdown
Contributor Author

@uyw4687 uyw4687 Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, added :)


def test_fullmatch_possessive_quantifiers(self):
self.assertTrue(re.fullmatch(r'a++', 'a'))
self.assertTrue(re.fullmatch(r'a*+', 'a'))
Expand Down
3 changes: 3 additions & 0 deletions Modules/_sre/sre_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,9 @@ SRE(match)(SRE_STATE* state, const SRE_CODE* pattern, int toplevel)
MARK_POP(ctx->lastmark);
LASTMARK_RESTORE();

/* Return to the previous Input Stream pointer */
state->ptr = ptr;

/* We have sufficient matches, so exit loop. */
break;
}
Expand Down