]> granicus.if.org Git - python/commitdiff
In subst_vars(), change the name of the argument from str to s to
authorJeremy Hylton <jeremy@alum.mit.edu>
Thu, 25 Jan 2001 20:10:32 +0000 (20:10 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Thu, 25 Jan 2001 20:10:32 +0000 (20:10 +0000)
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.)

Lib/distutils/util.py

index 80e4814389c00e9c8506b8d1facb5ec306a39ebc..550d94abb6a75167a67f0042577d7bfcb7ea02ce 100644 (file)
@@ -142,7 +142,7 @@ def check_environ ():
     _environ_checked = 1
 
 
-def subst_vars (str, local_vars):
+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
     variable is substituted by the value found in the 'local_vars'
@@ -160,7 +160,7 @@ def subst_vars (str, local_vars):
             return os.environ[var_name]
 
     try:
-        return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, str)
+        return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, s)
     except KeyError, var:
         raise ValueError, "invalid variable '$%s'" % var