[gnome-continuous-yocto/gnomeostree-3.28-rocko: 60/8267] bitbake: bb.data_smart: use iter() for __len__



commit 39b79efc7e39f677287447a608892790b57e3e00
Author: Christopher Larson <chris_larson mentor com>
Date:   Sat Apr 30 12:43:54 2016 -0700

    bitbake: bb.data_smart: use iter() for __len__
    
    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.
    
    (Bitbake rev: b492836e08745e04bd9ba2fb0b56a680a5fdce79)
    
    Signed-off-by: Christopher Larson <chris_larson mentor com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 bitbake/lib/bb/data_smart.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index fa1e794..2ab884b 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/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)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]