mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
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.)
This commit is contained in:
parent
a3661e1267
commit
00dc5a93c1
1 changed files with 3 additions and 4 deletions
|
@ -554,8 +554,8 @@ class ConfigParser(RawConfigParser):
|
||||||
if value.find("%(") != -1:
|
if value.find("%(") != -1:
|
||||||
try:
|
try:
|
||||||
value = value % vars
|
value = value % vars
|
||||||
except KeyError, key:
|
except KeyError, e:
|
||||||
raise InterpolationError(key, option, section, rawval)
|
raise InterpolationError(e[0], option, section, rawval)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
if value.find("%(") != -1:
|
if value.find("%(") != -1:
|
||||||
|
@ -599,8 +599,7 @@ class SafeConfigParser(ConfigParser):
|
||||||
try:
|
try:
|
||||||
v = map[var]
|
v = map[var]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise InterpolationError(
|
raise InterpolationError(var, option, section, rest)
|
||||||
"no value found for %r" % var)
|
|
||||||
if "%" in v:
|
if "%" in v:
|
||||||
self._interpolate_some(option, accum, v,
|
self._interpolate_some(option, accum, v,
|
||||||
section, map, depth + 1)
|
section, map, depth + 1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue