From: Zac Medico Date: Mon, 2 Oct 2006 22:39:03 +0000 (-0000) Subject: Optimize varexpand for bug #149900. X-Git-Tag: v2.1.2~730 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4dc0fe373246e2b593f4ce8858bead44d6cc3434;p=portage.git Optimize varexpand for bug #149900. svn path=/main/trunk/; revision=4574 --- diff --git a/pym/portage_util.py b/pym/portage_util.py index 83cdeda50..9d1bb84c2 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -286,10 +286,10 @@ def getconfig(mycfg,tolerant=0,allow_sourcing=False): #cache expansions of constant strings cexpand={} def varexpand(mystring,mydict={}): - try: - return cexpand[" "+mystring] - except KeyError: - pass + newstring = cexpand.get(" "+mystring, None) + if newstring is not None: + return newstring + """ new variable expansion code. Removes quotes, handles \n, etc. This code is used by the configfile code, as well as others (parser)