diff -r a7bf938bc1e3 Lib/test/test_re.py --- a/Lib/test/test_re.py Thu Mar 20 11:28:16 2014 -0500 +++ b/Lib/test/test_re.py Thu Mar 20 22:25:10 2014 +0200 @@ -1223,6 +1223,11 @@ pat.scanner(string='abracadabra', pos=3, endpos=10).search().span(), (7, 9)) + def test_bug_20998(self): + # Issue #20998: Fullmatch of repeated single character pattern + # with ignore case. + self.assertEqual(re.fullmatch('[a-c]+$', 'abc', re.I).span(), (0, 3)) + class PatternReprTests(unittest.TestCase): def check(self, pattern, expected): diff -r a7bf938bc1e3 Modules/sre_lib.h --- a/Modules/sre_lib.h Thu Mar 20 11:28:16 2014 -0500 +++ b/Modules/sre_lib.h Thu Mar 20 22:25:10 2014 +0200 @@ -259,7 +259,10 @@ /* repeated single character pattern */ TRACE(("|%p|%p|COUNT SUBPATTERN\n", pattern, ptr)); while ((SRE_CHAR*) state->ptr < end) { + int match_all = state->match_all; + state->match_all = 0; i = SRE(match)(state, pattern); + state->match_all = match_all; if (i < 0) return i; if (!i)