[issue29420] Python 3.6 change in dict iteration when inserting keys

2017-02-02 Thread Matthew Brett
Matthew Brett added the comment: To clarify from comments on issue 19332: """ * The normal rule (not just for Python) is that a data structures have undefined behavior for mutating while iterating, unless there is a specific guarantee """ The change in Python 3.6 is just a different undefined

[issue29420] Python 3.6 change in dict iteration when inserting keys

2017-02-02 Thread R. David Murray
R. David Murray added the comment: This "bug" has always existed, its just that its manifestation has changed. See issue 19332 for background. -- nosy: +r.david.murray resolution: -> duplicate stage: -> resolved status: open -> closed superseder: -> Guard against changing dict durin

[issue29420] Python 3.6 change in dict iteration when inserting keys

2017-02-02 Thread Matthew Brett
New submission from Matthew Brett: The behavior of dict iteration has changed in Python 3.6, in that inserting keys during iteration has a different and unpredictable affect. For this code: d = {'foo': 1} for key in d: print(key) d.pop(key) d[key] = 1 Python 3.5 prints a single 'foo'