Nikolaus Rath added the comment:
Raymond, it would be nice if you could respond to my last comment...
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19414
___
Raymond Hettinger added the comment:
Sorry Nikolaus, I'm happy with the code and docs as they are. In general, you
should assume that unless documented otherwise, any pure python container
(stdlib or 3rd party) has undefined behavior if you mutate while iterating
(like you should not assume
Nikolaus Rath added the comment:
Raymond, I think your patch does not really address the issue reported here.
The dict documentation still guarantees that mutating a dict during iteration
will raise a RuntimeError or may skip elements. The OrderedDict documentation
still does not point out
Roundup Robot added the comment:
New changeset a3c345ba3563 by Raymond Hettinger in branch 'default':
Issue #19414: Have the OrderedDict mark deleted links as unusable.
http://hg.python.org/cpython/rev/a3c345ba3563
--
nosy: +python-dev
___
Python
Raymond Hettinger added the comment:
To address Armin's concern, I'm triggering an early failure by setting the link
fields to None. That will help prevent accidental reliance on non-guaranteed
behaviors.
--
resolution: - fixed
status: open - closed
Nikolaus Rath added the comment:
The patch applies cleanly to 3.4 and 3.5, not sure why the review link does not
show up. I'm attaching the file again, maybe that helps.
--
Added file: http://bugs.python.org/file34804/issue19414_r2.diff
___
Python
Chris Angelico added the comment:
I agree that current behaviour is a bit confusing; also, the implication is
that deleting from the dictionary while you have an iterator may leave some
hanging references around the place, which raises a red flag in my mind (maybe
something else might find
Changes by Alexander Belopolsky alexander.belopol...@gmail.com:
--
nosy: +belopolsky
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19414
___
___
Nikolaus Rath added the comment:
I have attached a patch that fixes this issue. Looking at Raymonds comments in
issue 19332, I have kept new code out of the critical path in __iter__ and
instead modified the __delitem__ method (I assume that an element is removed
only once, but may be
Changes by Nikolaus Rath nikol...@rath.org:
--
title: OrderedDict.values() behavior for modified instance -
iter(ordered_dict) yields keys not in dict in some circumstances
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19414
10 matches
Mail list logo