From 0ee07023a1ab2e587ef18c92306917444d0d3f52 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 15 Apr 2018 02:35:46 -0700 Subject: [PATCH] Fix ids_needed being modified while iterating. --- etiquette/photodb.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/etiquette/photodb.py b/etiquette/photodb.py index 3c95819..902980e 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -1469,16 +1469,15 @@ class PhotoDB( thing_class = thing_map['class'] thing_cache = self.caches[thing_type] - ids_needed = set(thing_ids) + ids_needed = set() things = set() - for thing_id in ids_needed: + for thing_id in thing_ids: try: thing = thing_cache[thing_id] except KeyError: - pass + ids_needed.add(thing_id) else: things.add(thing) - ids_needed.remove(thing.id) yield from things