diff options
author | Fred Drake <fdrake@acm.org> | 2002-12-31 06:55:41 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2002-12-31 06:55:41 (GMT) |
commit | 00dc5a93c12484c3df57bd3bf2e0c6e78345a98b (patch) | |
tree | 1f04a9596444afd129e5917611fa07322620e62b | |
parent | a3661e126768c7d6850308af4fce8a2efbcf45e2 (diff) | |
download | cpython-00dc5a93c12484c3df57bd3bf2e0c6e78345a98b.zip cpython-00dc5a93c12484c3df57bd3bf2e0c6e78345a98b.tar.gz cpython-00dc5a93c12484c3df57bd3bf2e0c6e78345a98b.tar.bz2 |
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.)
-rw-r--r-- | Lib/ConfigParser.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py index 24a4f23..7c2eba5 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) |