summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-01-25 20:10:32 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-01-25 20:10:32 (GMT)
commit5e2d0764cd95b40de64fff54e14091e0e6bdf6f6 (patch)
treeaec6d6daad08c4e58ef2781212fa7d9261d20e81
parenta39414b15ca4b1a8e1b3cd7db463403ab0af933e (diff)
downloadcpython-5e2d0764cd95b40de64fff54e14091e0e6bdf6f6.zip
cpython-5e2d0764cd95b40de64fff54e14091e0e6bdf6f6.tar.gz
cpython-5e2d0764cd95b40de64fff54e14091e0e6bdf6f6.tar.bz2
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.)
-rw-r--r--Lib/distutils/util.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/distutils/util.py b/Lib/distutils/util.py
index 80e4814..550d94a 100644
--- a/Lib/distutils/util.py
+++ b/Lib/distutils/util.py
@@ -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