changeset 36117:c02771617a70

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Feb 2018 16:56:29 -0800
parents b587a889b97e
children 9e47bfbeb723
files mercurial/copies.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/copies.py	Sun Feb 11 16:54:56 2018 -0800
+++ b/mercurial/copies.py	Sun Feb 11 16:56:29 2018 -0800
@@ -123,7 +123,7 @@
             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]