[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-06-14 Thread Nikolaus Rath
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 ___

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-06-14 Thread Raymond Hettinger
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

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-05-07 Thread Nikolaus Rath
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

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-05-03 Thread Roundup Robot
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

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-05-03 Thread Raymond Hettinger
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

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-04-13 Thread Nikolaus Rath
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

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-04-12 Thread Chris Angelico
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

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-04-12 Thread Alexander Belopolsky
Changes by Alexander Belopolsky alexander.belopol...@gmail.com: -- nosy: +belopolsky ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19414 ___ ___

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2014-01-07 Thread Nikolaus Rath
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

[issue19414] iter(ordered_dict) yields keys not in dict in some circumstances

2013-10-30 Thread Nikolaus Rath
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