From: Zac Medico Date: Sat, 31 Mar 2012 20:27:11 +0000 (-0700) Subject: varexpand: use frozenset for word characters X-Git-Tag: v2.2.0_alpha97~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ebb542165883468ebf31341e150cdbebcd7439a4;p=portage.git varexpand: use frozenset for word characters --- diff --git a/pym/portage/util/__init__.py b/pym/portage/util/__init__.py index ae560c0d5..a7bc9bd0f 100644 --- a/pym/portage/util/__init__.py +++ b/pym/portage/util/__init__.py @@ -646,6 +646,8 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True): raise portage.exception.ParseError(str(e)+" in "+mycfg) return mykeys +_varexpand_word_chars = frozenset(string.ascii_letters + string.digits + "_") + def varexpand(mystring, mydict=None): if mydict is None: mydict = {} @@ -715,8 +717,7 @@ def varexpand(mystring, mydict=None): else: braced=False myvstart=pos - validchars=string.ascii_letters+string.digits+"_" - while mystring[pos] in validchars: + while mystring[pos] in _varexpand_word_chars: if (pos+1)>=len(mystring): if braced: return ""