[oe-commits] [bitbake] 03/03: bb.data_smart: use iter() for __len__

git at git.openembedded.org git at git.openembedded.org
Fri May 6 09:18:48 UTC 2016


rpurdie pushed a commit to branch master
in repository bitbake.

commit b492836e08745e04bd9ba2fb0b56a680a5fdce79
Author: Christopher Larson <chris_larson at mentor.com>
AuthorDate: Sat Apr 30 12:43:54 2016 -0700

    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.
    
    Signed-off-by: Christopher Larson <chris_larson at mentor.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 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)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list