D2164: py3: avoid changing dictionary during iteration

2018-02-12 Thread indygreg (Gregory Szorc)
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc02771617a70: py3: avoid changing dictionary during 
iteration (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2164?vs=5465&id=5588

REVISION DETAIL
  https://phab.mercurial-scm.org/D2164

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -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]
 



To: indygreg, #hg-reviewers, pulkit, durin42
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


D2164: py3: avoid changing dictionary during iteration

2018-02-11 Thread indygreg (Gregory Szorc)
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION 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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2164

AFFECTED FILES
  mercurial/copies.py

CHANGE DETAILS

diff --git a/mercurial/copies.py b/mercurial/copies.py
--- a/mercurial/copies.py
+++ b/mercurial/copies.py
@@ -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]
 



To: indygreg, #hg-reviewers
Cc: mercurial-devel
___
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel