mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Issue 2246: itertools grouper object did not participate in GC (should be backported).
This commit is contained in:
parent
ad47fa141c
commit
a1ca94a102
2 changed files with 22 additions and 5 deletions
|
@ -766,6 +766,13 @@ class TestGC(unittest.TestCase):
|
|||
a = []
|
||||
self.makecycle(groupby([a]*2, lambda x:x), a)
|
||||
|
||||
def test_issue2246(self):
|
||||
# Issue 2246 -- the _grouper iterator was not included in GC
|
||||
n = 10
|
||||
keyfunc = lambda x: x
|
||||
for i, j in groupby(xrange(n), key=keyfunc):
|
||||
keyfunc.__dict__.setdefault('x',[]).append(j)
|
||||
|
||||
def test_ifilter(self):
|
||||
a = []
|
||||
self.makecycle(ifilter(lambda x:True, [a]*2), a)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue