mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-140517: fix leak in map_next in strict mode (GH-140543) (#140554)
gh-140517: fix leak in `map_next` in strict mode (GH-140543)
(cherry picked from commit be5af997f3)
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
This commit is contained in:
parent
a975bea9b5
commit
11b5e0b9c2
2 changed files with 41 additions and 19 deletions
|
|
@ -1384,6 +1384,22 @@ def test_map_strict(self):
|
|||
self.assertRaises(ValueError, tuple,
|
||||
map(pack, (1, 2), (1, 2), 'abc', strict=True))
|
||||
|
||||
# gh-140517: Testing refleaks with mortal objects.
|
||||
t1 = (None, object())
|
||||
t2 = (object(), object())
|
||||
t3 = (object(),)
|
||||
|
||||
self.assertRaises(ValueError, tuple,
|
||||
map(pack, t1, 'a', strict=True))
|
||||
self.assertRaises(ValueError, tuple,
|
||||
map(pack, t1, t2, 'a', strict=True))
|
||||
self.assertRaises(ValueError, tuple,
|
||||
map(pack, t1, t2, t3, strict=True))
|
||||
self.assertRaises(ValueError, tuple,
|
||||
map(pack, 'a', t1, strict=True))
|
||||
self.assertRaises(ValueError, tuple,
|
||||
map(pack, 'a', t2, t3, strict=True))
|
||||
|
||||
def test_map_strict_iterators(self):
|
||||
x = iter(range(5))
|
||||
y = [0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue