This is an archive of the discontinued Mercurial Phabricator instance.

py3: avoid changing dictionary during iteration
ClosedPublic

Authored by indygreg on Feb 11 2018, 9:35 PM.

Details

Summary

dict.items() and friends are iterators/views in Python 3. You
aren't allowed to mutate the underlying dictionary when iterating
on these views. So iterate over a copy of things.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Feb 11 2018, 9:35 PM
pulkit accepted this revision.Feb 12 2018, 2:37 AM
durin42 accepted this revision.Feb 12 2018, 9:31 PM
This revision is now accepted and ready to land.Feb 12 2018, 9:31 PM
This revision was automatically updated to reflect the committed changes.