[bitbake-devel] [master][PATCH 3/3] bb.data_smart: use iter() for __len__

Christopher Larson kergoth at gmail.com
Sat Apr 30 19:43:54 UTC 2016


From: Christopher Larson <chris_larson at mentor.com>

It seems the frozenset constructor in pypy runs len(), so we can't pass the
DataSmart instance directly to it, instead pass the iterator. Fixes pypy
support.

Signed-off-by: Christopher Larson <chris_larson at mentor.com>
---
 lib/bb/data_smart.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index fa1e794..2ab884b 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -917,7 +917,7 @@ class DataSmart(MutableMapping):
              yield k
 
     def __len__(self):
-        return len(frozenset(self))
+        return len(frozenset(iter(self)))
 
     def __getitem__(self, item):
         value = self.getVar(item, False)
-- 
2.8.0




More information about the bitbake-devel mailing list