bpo-36473: add maximum iteration check for dict .values() and .items() (GH-12619)

This commit is contained in:
Thomas Perl 2019-04-02 11:30:10 +02:00 committed by Inada Naoki
parent 04694a306b
commit b8311cf5e5
3 changed files with 36 additions and 2 deletions

View file

@ -1 +1,5 @@
Changing `dict` keys during iteration will now be detected in certain corner cases where the number of keys isn't changed (but they keys themselves are), and a `RuntimeError` will be raised.
Changing ``dict`` keys during iteration of the dict itself, ``keys()``,
``values()``, or ``items()`` will now be detected in certain corner cases where
keys are deleted/added so that the number of keys isn't changed.
A `RuntimeError` will be raised after ``len(dict)`` iterations.
Contributed by Thomas Perl.