diff options
author | Thomas Perl <m@thp.io> | 2019-03-28 06:03:25 (GMT) |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2019-03-28 06:03:25 (GMT) |
commit | 796cc6e3ad3617c1ea9e528663aac1a206230a28 (patch) | |
tree | 0af419b927af85d970dc7f1c207e04a1744704cd /Lib/test | |
parent | 738cb42a14481aa9ae58704f6bee951308212d7e (diff) | |
download | cpython-796cc6e3ad3617c1ea9e528663aac1a206230a28.zip cpython-796cc6e3ad3617c1ea9e528663aac1a206230a28.tar.gz cpython-796cc6e3ad3617c1ea9e528663aac1a206230a28.tar.bz2 |
bpo-36452: dictiter: track maximum iteration count (GH-12596)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_dict.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index 03afd5b..eecdc8b 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -470,6 +470,15 @@ class DictTest(unittest.TestCase): for i in d: d[i+1] = 1 + def test_mutating_iteration_delete(self): + # change dict content during iteration + d = {} + d[0] = 0 + with self.assertRaises(RuntimeError): + for i in d: + del d[0] + d[1] = 1 + def test_mutating_lookup(self): # changing dict during a lookup (issue #14417) class NastyKey: |