diff --git a/gramps/plugins/database/dictionarydb.py b/gramps/plugins/database/dictionarydb.py index a1c0afdb8..29e762fc7 100644 --- a/gramps/plugins/database/dictionarydb.py +++ b/gramps/plugins/database/dictionarydb.py @@ -520,11 +520,9 @@ class DictionaryDb(DbGeneric): emit = None if tag.handle in self.tag_map: emit = "tag-update" - existing_names = [existing_name for existing_name, existing_tag in - self._tag_name_dict.items() - if existing_tag.handle == tag.handle] - for existing_name in existing_names: - del self._tag_name_dict[existing_name] + for old_name, old_tag in list(self._tag_name_dict.items()): + if old_tag.handle == tag.handle: + del self._tag_name_dict[old_name] self._tag_dict[tag.handle] = tag self._tag_name_dict[tag.name] = tag else: