Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add bpo-42536 style test for gc tracking
  • Loading branch information
hauntsaninja committed Apr 24, 2024
commit ea0cfd6759e0a10cc557984ff40446c7fc30e6c0
7 changes: 7 additions & 0 deletions Lib/test/test_itertools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1821,6 +1821,13 @@ def test_zip_longest_result_gc(self):
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()
Comment on lines +1827 to +1828
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all tests above except for zip_longest there is a next(it) before gc.collect(). All these tests were added in 226a012 (bpo-42536).

@brandtbucher, why is such difference? Is there a bug in test_zip_longest_result_gc? Do we need next(it) there and here?

self.assertTrue(gc.is_tracked(next(it)))

@support.cpython_only
def test_immutable_types(self):
from itertools import _grouper, _tee, _tee_dataobject
Expand Down