Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure#32283
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
e5317fe28e4d2d7493fadb928335dfec05ddb7e88ba43cb6e1560a0c96be0257ee3e66e95b19fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -13,7 +13,7 @@ | ||
| # update when constants are added or removed | ||
| MAGIC =20220402 | ||
| from _sre import MAXREPEAT, MAXGROUPS | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1643,9 +1643,12 @@ def test_dealloc(self): | ||
| long_overflow = 2**128 | ||
| self.assertRaises(TypeError, re.finditer, "a", {}) | ||
| with self.assertRaises(OverflowError): | ||
| _sre.compile("abc", 0, [long_overflow], 0, {}, (), 0) | ||
| with self.assertRaises(TypeError): | ||
| _sre.compile({}, 0, [], 0, [], [], 0) | ||
| with self.assertRaises(RuntimeError): | ||
| # invalid repeat_count -1 | ||
| _sre.compile("abc", 0, [1], 0, {}, (), -1) | ||
| def test_search_dot_unicode(self): | ||
| self.assertTrue(re.search("123.*-", '123abc-')) | ||
| @@ -2334,6 +2337,27 @@ def test_possesive_repeat(self): | ||
| 14. SUCCESS | ||
| ''') | ||
| def test_repeat_index(self): | ||
| self.assertEqual(get_debug_out(r'(?:ab)*?(?:cd)*'), '''\ | ||
| MIN_REPEAT 0 MAXREPEAT | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. You just read my mind! I was going to propose such a change, but I thought that I was already bothering you too much. Author
| ||
| LITERAL 97 | ||
| LITERAL 98 | ||
| MAX_REPEAT 0 MAXREPEAT | ||
| LITERAL 99 | ||
| LITERAL 100 | ||
| 0. INFO 4 0b0 0 MAXREPEAT (to 5) | ||
| 5: REPEAT 8 0 MAXREPEAT 0 (to 14) | ||
| 10. LITERAL 0x61 ('a') | ||
| 12. LITERAL 0x62 ('b') | ||
| 14: MIN_UNTIL | ||
| 15. REPEAT 8 0 MAXREPEAT 1 (to 24) | ||
| 20. LITERAL 0x63 ('c') | ||
| 22. LITERAL 0x64 ('d') | ||
| 24: MAX_UNTIL | ||
| 25. SUCCESS | ||
| ''') | ||
| class PatternReprTests(unittest.TestCase): | ||
| def check(self, pattern, expected): | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| :mod:`re` module: fix memory leak when a match is terminated by a signal or | ||
| memory allocation failure. Patch by Ma Lin. |
Uh oh!
There was an error while loading.Please reload this page.