mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-91404: Revert "bpo-23689: re module, fix memory leak when a match is terminated by a signal or allocation failure (GH-32283) (#93882)
Revert "bpo-23689: re module, fix memory leak when a match is terminated by a signal or memory allocation failure (GH-32283)"
This reverts commit 6e3eee5c11
.
Manual fixups to increase the MAGIC number and to handle conflicts with
a couple of changes that landed after that.
Thanks for reviews by Ma Lin and Serhiy Storchaka.
This commit is contained in:
parent
538f28921f
commit
4beee0c7b0
9 changed files with 74 additions and 146 deletions
|
@ -1765,12 +1765,9 @@ class ReTests(unittest.TestCase):
|
|||
long_overflow = 2**128
|
||||
self.assertRaises(TypeError, re.finditer, "a", {})
|
||||
with self.assertRaises(OverflowError):
|
||||
_sre.compile("abc", 0, [long_overflow], 0, {}, (), 0)
|
||||
_sre.compile("abc", 0, [long_overflow], 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)
|
||||
_sre.compile({}, 0, [], 0, [], [])
|
||||
|
||||
def test_search_dot_unicode(self):
|
||||
self.assertTrue(re.search("123.*-", '123abc-'))
|
||||
|
@ -2509,27 +2506,6 @@ POSSESSIVE_REPEAT 0 1
|
|||
14. SUCCESS
|
||||
''')
|
||||
|
||||
def test_repeat_index(self):
|
||||
self.assertEqual(get_debug_out(r'(?:ab)*?(?:cd)*'), '''\
|
||||
MIN_REPEAT 0 MAXREPEAT
|
||||
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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue