Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of bytearray,
list, tuple, set, frozenset, dict, OrderedDict and corresponding views.
diff --git a/Lib/test/test_iter.py b/Lib/test/test_iter.py
index bd1b32d..4495fa1 100644
--- a/Lib/test/test_iter.py
+++ b/Lib/test/test_iter.py
@@ -2,7 +2,8 @@
import unittest
from test.test_support import run_unittest, TESTFN, unlink, have_unicode, \
- check_py3k_warnings, cpython_only
+ check_py3k_warnings, cpython_only, \
+ check_free_after_iterating
# Test result of triple loop (too big to inline)
TRIPLETS = [(0, 0, 0), (0, 0, 1), (0, 0, 2),
@@ -921,6 +922,9 @@
lst.extend(gen())
self.assertEqual(len(lst), 760)
+ def test_free_after_iterating(self):
+ check_free_after_iterating(self, iter, SequenceClass, (0,))
+
def test_main():
run_unittest(TestCase)