diff --git a/mercurial/tags.py b/mercurial/tags.py --- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -244,7 +244,7 @@ # remove tags pointing to invalid nodes cl = repo.changelog - for t in filetags.keys(): + for t in list(filetags): try: cl.rev(filetags[t][0]) except (LookupError, ValueError):