[Python-checkins] CVS: python/dist/src/Lib/distutils util.py,1.57,1.58

Jeremy Hylton jhylton@users.sourceforge.net
Thu, 25 Jan 2001 12:10:34 -0800


Update of /cvsroot/python/python/dist/src/Lib/distutils
In directory usw-pr-cvs1:/tmp/cvs-serv24763

Modified Files:
	util.py 
Log Message:
In subst_vars(), change the name of the argument from str to s to
prevent binding for str from masking use of builtin str in nested
function.

(This is the only case I found in the standard library where a local
shadows a global or builtin.  There may be others, but the regression
test doesn't catch them.)



Index: util.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/util.py,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -r1.57 -r1.58
*** util.py	2001/01/19 16:26:12	1.57
--- util.py	2001/01/25 20:10:32	1.58
***************
*** 143,147 ****
  
  
! def subst_vars (str, local_vars):
      """Perform shell/Perl-style variable substitution on 'string'.  Every
      occurrence of '$' followed by a name is considered a variable, and
--- 143,147 ----
  
  
! def subst_vars (s, local_vars):
      """Perform shell/Perl-style variable substitution on 'string'.  Every
      occurrence of '$' followed by a name is considered a variable, and
***************
*** 161,165 ****
  
      try:
!         return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, str)
      except KeyError, var:
          raise ValueError, "invalid variable '$%s'" % var
--- 161,165 ----
  
      try:
!         return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, s)
      except KeyError, var:
          raise ValueError, "invalid variable '$%s'" % var