summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_dict.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-03-30 17:41:15 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-03-30 17:41:15 (GMT)
commitab479c49d31be03e85b824b8444b474b28e6db71 (patch)
treef171c7cb1f6e5568b7309665b0e87dae9dda67f5 /Lib/test/test_dict.py
parentfe4c01268cf9e94869a476495213fc362ef3a697 (diff)
parentfbb1c5ee068d209e33f6e15ecb4821d5d8b107fa (diff)
downloadcpython-ab479c49d31be03e85b824b8444b474b28e6db71.zip
cpython-ab479c49d31be03e85b824b8444b474b28e6db71.tar.gz
cpython-ab479c49d31be03e85b824b8444b474b28e6db71.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_dict.py')
-rw-r--r--Lib/test/test_dict.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py
index 1049be5..7dd44b9 100644
--- a/Lib/test/test_dict.py
+++ b/Lib/test/test_dict.py
@@ -954,6 +954,12 @@ class DictTest(unittest.TestCase):
d = {X(): 0, 1: 1}
self.assertRaises(RuntimeError, d.update, other)
+ def test_free_after_iterating(self):
+ support.check_free_after_iterating(self, iter, dict)
+ support.check_free_after_iterating(self, lambda d: iter(d.keys()), dict)
+ support.check_free_after_iterating(self, lambda d: iter(d.values()), dict)
+ support.check_free_after_iterating(self, lambda d: iter(d.items()), dict)
+
from test import mapping_tests
class GeneralMappingTests(mapping_tests.BasicTestMappingProtocol):