gh-118218: Reuse return tuple in itertools.pairwise (GH-118219)

This commit is contained in:
Shantanu 2024-04-30 13:16:52 -07:00 committed by GitHub
parent b568c2c1ff
commit 6999d68d28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 2 deletions

View file

@ -1821,6 +1821,13 @@ class TestBasicOps(unittest.TestCase):
gc.collect()
self.assertTrue(gc.is_tracked(next(it)))
@support.cpython_only
def test_pairwise_result_gc(self):
# Ditto for pairwise.
it = pairwise([None, None])
gc.collect()
self.assertTrue(gc.is_tracked(next(it)))
@support.cpython_only
def test_immutable_types(self):
from itertools import _grouper, _tee, _tee_dataobject