diff Lib/ConfigParser.py @ 26927:33dcf4fd0ff9 legacy-trunk

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.)
author Fred Drake <fdrake@acm.org>
date Tue, 31 Dec 2002 06:55:41 +0000
parents 074919715355
children 776f270a6ea9
line wrap: on
line diff
--- a/Lib/ConfigParser.py	Tue Dec 31 05:51:05 2002 +0000
+++ b/Lib/ConfigParser.py	Tue Dec 31 06:55:41 2002 +0000
@@ -554,8 +554,8 @@
             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 @@
                 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)