Make varexpand() create a new empty dict for variable expansions in
authorZac Medico <zmedico@gentoo.org>
Fri, 20 Aug 2010 22:32:13 +0000 (15:32 -0700)
committerZac Medico <zmedico@gentoo.org>
Fri, 20 Aug 2010 22:32:13 +0000 (15:32 -0700)
case one is not passed in. This will prevent some potentially
confusing behavior.

pym/portage/util/__init__.py

index 8b110f8a850bf133f596d9146ef93141ffa7902d..b5ae524b0385ce5540ce539a27a89ba90d49b567 100644 (file)
@@ -498,7 +498,9 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
        
 #cache expansions of constant strings
 cexpand={}
-def varexpand(mystring, mydict={}):
+def varexpand(mystring, mydict=None):
+       if mydict is None:
+               mydict = {}
        newstring = cexpand.get(" "+mystring, None)
        if newstring is not None:
                return newstring