# HG changeset patch # User Gregory Szorc # Date 2018-02-12 00:56:29 # Node ID c02771617a70bb662a776306330ce4ef752f0718 # Parent b587a889b97ead86dd3bb2125b47588d2d371779 py3: avoid changing dictionary during iteration 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. Differential Revision: https://phab.mercurial-scm.org/D2164 diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -123,7 +123,7 @@ def _chain(src, dst, a, b): t[k] = v # remove criss-crossed copies - for k, v in t.items(): + for k, v in list(t.items()): if k in src and v in dst: del t[k]