[pypy-issue] [issue1100] Dict iterators can return deleted entries
Armin Rigo
tracker at bugs.pypy.org
Mon Mar 26 15:28:58 CEST 2012
New submission from Armin Rigo <armin.rigo at gmail.com>:
Dict iterators (and sets in the set-strategies branch) may return deleted
entries if the dict is "cleverly" mutated while iterating in a way that changes
its strategy. While it's known that iterating over a mutated dict should not be
done, the result can still be surprizing:
>>>> d = {3:4, 6:7}
>>>> it = d.iteritems()
>>>> d['foo'] = 'bar'
>>>> del d[6]
>>>> it.next()
(3, 4)
>>>> it.next()
(6, 7)
Maybe the dict iterator should check not only that the dict size didn't change,
but also that its strategy is still the same one.
----------
messages: 4144
nosy: arigo, pypy-issue
priority: bug
status: unread
title: Dict iterators can return deleted entries
________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1100>
________________________________________
More information about the pypy-issue
mailing list