summaryrefslogtreecommitdiff
path: root/Lib/ConfigParser.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-12-31 06:55:41 +0000
committerFred Drake <fdrake@acm.org>2002-12-31 06:55:41 +0000
commitd1812b9bf3af12da02531b35a1b2c2ed4467b31e (patch)
tree10d4fad31adbe9be9da5f57970ed3f49a7db163c /Lib/ConfigParser.py
parentca7a8f0c0d1ab9e8882d9469414a91c4614ca21f (diff)
downloadcpython-d1812b9bf3af12da02531b35a1b2c2ed4467b31e.tar.gz
ConfigParser._interpolate(): Pass the missing key to the
InterpolationError constructor, not the KeyError exception itself. (Caught by the new InterpolationError test.) SafeConfigParser._interpolate_some(): Pass the right number of arguments to the InterpolationError constructor. (Caught by pychecker.)
Diffstat (limited to 'Lib/ConfigParser.py')
-rw-r--r--Lib/ConfigParser.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py
index 24a4f23eb3..7c2eba5cff 100644
--- a/Lib/ConfigParser.py
+++ b/Lib/ConfigParser.py
@@ -554,8 +554,8 @@ class ConfigParser(RawConfigParser):
if value.find("%(") != -1:
try:
value = value % vars
- except KeyError, key:
- raise InterpolationError(key, option, section, rawval)
+ except KeyError, e:
+ raise InterpolationError(e[0], option, section, rawval)
else:
break
if value.find("%(") != -1:
@@ -599,8 +599,7 @@ class SafeConfigParser(ConfigParser):
try:
v = map[var]
except KeyError:
- raise InterpolationError(
- "no value found for %r" % var)
+ raise InterpolationError(var, option, section, rest)
if "%" in v:
self._interpolate_some(option, accum, v,
section, map, depth + 1)