Skip to contentSkip to conversation

data_smart: Ensure d.keys() doesn't list deleted variables

PATCH New Richard Purdie 1 participant 1 message Dec 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 data_smart: Ensure d.keys() doesn't list deleted variables

If you copy the datastore, then delete a variable, it still shows up in d.keys() when it should not. This patch addresses the issue.

bitbake/lib/bb/data_smart.py +4 -0
index 31ce9a5..68d273b 100644
@@ -740,12 +740,16 @@ class DataSmart(MutableMapping):
                 yield key
 
     def __iter__(self):
+        deleted = set()
         def keylist(d):        
             klist = set()
             for key in d:
                 if key == "_data":
                     continue
+                if key in deleted:
+                    continue
                 if not d[key]:
+                    deleted.add(key)
                     continue
                 klist.add(key)