summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_iter.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-03-30 17:40:02 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-03-30 17:40:02 (GMT)
commitfbb1c5ee068d209e33f6e15ecb4821d5d8b107fa (patch)
tree4ae6657a598c5cfe5357f3106d956ed721d83e24 /Lib/test/test_iter.py
parent13b3acd13e35b5e619c3d1aab90aaf54abc1fb53 (diff)
downloadcpython-fbb1c5ee068d209e33f6e15ecb4821d5d8b107fa.zip
cpython-fbb1c5ee068d209e33f6e15ecb4821d5d8b107fa.tar.gz
cpython-fbb1c5ee068d209e33f6e15ecb4821d5d8b107fa.tar.bz2
Issue #26494: Fixed crash on iterating exhausting iterators.
Affected classes are generic sequence iterators, iterators of str, bytes, bytearray, list, tuple, set, frozenset, dict, OrderedDict, corresponding views and os.scandir() iterator.
Diffstat (limited to 'Lib/test/test_iter.py')
-rw-r--r--Lib/test/test_iter.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_iter.py b/Lib/test/test_iter.py
index 56e21f8..54ddbaa 100644
--- a/Lib/test/test_iter.py
+++ b/Lib/test/test_iter.py
@@ -3,6 +3,7 @@
import sys
import unittest
from test.support import run_unittest, TESTFN, unlink, cpython_only
+from test.support import check_free_after_iterating
import pickle
import collections.abc
@@ -980,6 +981,9 @@ class TestCase(unittest.TestCase):
self.assertEqual(next(it), 0)
self.assertEqual(next(it), 1)
+ def test_free_after_iterating(self):
+ check_free_after_iterating(self, iter, SequenceClass, (0,))
+
def test_main():
run_unittest(TestCase)