From ebb542165883468ebf31341e150cdbebcd7439a4 Mon Sep 17 00:00:00 2001
From: Zac Medico <zmedico@gentoo.org>
Date: Sat, 31 Mar 2012 13:27:11 -0700
Subject: [PATCH] varexpand: use frozenset for word characters

---
 pym/portage/util/__init__.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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 ""
-- 
2.26.2