Fix stack_dicts() to always return a dict.
authorZac Medico <zmedico@gentoo.org>
Tue, 22 Sep 2009 22:00:42 +0000 (22:00 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 22 Sep 2009 22:00:42 +0000 (22:00 -0000)
svn path=/main/trunk/; revision=14389

pym/portage/util.py

index d89f723c893d2697f80399c92a7cf00499fb09ca..df1c1a1e4b0162c7c75c3c16856750090f928435 100644 (file)
@@ -216,12 +216,10 @@ def stack_dicts(dicts, incremental=0, incrementals=[], ignore_none=0):
        """Stacks an array of dict-types into one array. Optionally merging or
        overwriting matching key/value pairs for the dict[key]->string.
        Returns a single dict."""
-       final_dict = None
+       final_dict = {}
        for mydict in dicts:
                if not mydict:
                        continue
-               if final_dict is None:
-                       final_dict = {}
                for k, v in mydict.items():
                        if k in final_dict and (incremental or (k in incrementals)):
                                final_dict[k] += " " + v