summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-03-06 22:51:36 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-03-06 22:51:36 (GMT)
commita1ca94a1025c3ee1ddf29ebc6d76706f68cf6ea0 (patch)
treeb89886555bbc572ead18bf71f3d4c21fae3225aa /Lib
parentad47fa141ca77aee4d68d9f7a37e4bb891ec2682 (diff)
downloadcpython-a1ca94a1025c3ee1ddf29ebc6d76706f68cf6ea0.zip
cpython-a1ca94a1025c3ee1ddf29ebc6d76706f68cf6ea0.tar.gz
cpython-a1ca94a1025c3ee1ddf29ebc6d76706f68cf6ea0.tar.bz2
Issue 2246: itertools grouper object did not participate in GC (should be backported).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_itertools.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 135973e..3bd2255 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -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)