diff options
author | Raymond Hettinger <python@rcn.com> | 2008-03-06 22:58:42 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-03-06 22:58:42 (GMT) |
commit | 3662c9090db9831d689de006091d59b069849592 (patch) | |
tree | 4f4da680a1a7d9f0f83d086253e595f7b1b1bf90 /Lib/test/test_itertools.py | |
parent | ab61dce0e11a2160537a865afd50fdf48aa596dd (diff) | |
download | cpython-3662c9090db9831d689de006091d59b069849592.zip cpython-3662c9090db9831d689de006091d59b069849592.tar.gz cpython-3662c9090db9831d689de006091d59b069849592.tar.bz2 |
Backport r61286 adding GC to the grouper for itertools.groupby() fixing Issue 2246.
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r-- | Lib/test/test_itertools.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index 99f9077..e949cf6 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -449,6 +449,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) |