diff options
author | ?ukasz Langa <lukasz@langa.pl> | 2014-09-04 01:36:33 -0700 |
---|---|---|
committer | ?ukasz Langa <lukasz@langa.pl> | 2014-09-04 01:36:33 -0700 |
commit | a4e023a69ddfb2158df4e59f1678ef687f41c6b8 (patch) | |
tree | bfae809ca66c396ab2d2b33ad9a334ccd2ca2ed5 /Lib/configparser.py | |
parent | b5c4ebc4dff32a70396804f557e0143a573fdff1 (diff) | |
download | cpython-a4e023a69ddfb2158df4e59f1678ef687f41c6b8.tar.gz |
Fix #19546: onfigparser exceptions expose implementation details. Patch by Claudiu Popa.
Diffstat (limited to 'Lib/configparser.py')
-rw-r--r-- | Lib/configparser.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/configparser.py b/Lib/configparser.py index 4ee8307613..5843b0fc03 100644 --- a/Lib/configparser.py +++ b/Lib/configparser.py @@ -410,7 +410,7 @@ class BasicInterpolation(Interpolation): v = map[var] except KeyError: raise InterpolationMissingOptionError( - option, section, rest, var) + option, section, rest, var) from None if "%" in v: self._interpolate_some(parser, option, accum, v, section, map, depth + 1) @@ -482,7 +482,7 @@ class ExtendedInterpolation(Interpolation): "More than one ':' found: %r" % (rest,)) except (KeyError, NoSectionError, NoOptionError): raise InterpolationMissingOptionError( - option, section, rest, ":".join(path)) + option, section, rest, ":".join(path)) from None if "$" in v: self._interpolate_some(parser, opt, accum, v, sect, dict(parser.items(sect, raw=True)), @@ -515,7 +515,7 @@ class LegacyInterpolation(Interpolation): value = value % vars except KeyError as e: raise InterpolationMissingOptionError( - option, section, rawval, e.args[0]) + option, section, rawval, e.args[0]) from None else: break if value and "%(" in value: @@ -647,7 +647,7 @@ class RawConfigParser(MutableMapping): try: opts = self._sections[section].copy() except KeyError: - raise NoSectionError(section) + raise NoSectionError(section) from None opts.update(self._defaults) return list(opts.keys()) @@ -876,7 +876,7 @@ class RawConfigParser(MutableMapping): try: sectdict = self._sections[section] except KeyError: - raise NoSectionError(section) + raise NoSectionError(section) from None sectdict[self.optionxform(option)] = value def write(self, fp, space_around_delimiters=True): @@ -917,7 +917,7 @@ class RawConfigParser(MutableMapping): try: sectdict = self._sections[section] except KeyError: - raise NoSectionError(section) + raise NoSectionError(section) from None option = self.optionxform(option) existed = option in sectdict if existed: |