diff options
author | Fred Drake <fdrake@acm.org> | 2004-05-18 03:29:52 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 2004-05-18 03:29:52 (GMT) |
commit | abc086fb0df915b702f14fa3d44e79e0a8b8f11f (patch) | |
tree | 116d81dee23637a243b5446b1ee27c78e39741f6 /Lib/ConfigParser.py | |
parent | bc12b01d8349e185c8a52a0f2539e830dfae9adb (diff) | |
download | cpython-abc086fb0df915b702f14fa3d44e79e0a8b8f11f.zip cpython-abc086fb0df915b702f14fa3d44e79e0a8b8f11f.tar.gz cpython-abc086fb0df915b702f14fa3d44e79e0a8b8f11f.tar.bz2 |
ConfigParser:
- don't allow setting options to non-string values; raise TypeError
when the value is set, instead of raising an arbitrary exception
later (such as when string interpolation is performed)
- add tests, documentation
(closes SF bug #810843)
Diffstat (limited to 'Lib/ConfigParser.py')
-rw-r--r-- | Lib/ConfigParser.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py index 73acdd1..fccfcdf 100644 --- a/Lib/ConfigParser.py +++ b/Lib/ConfigParser.py @@ -343,6 +343,8 @@ class RawConfigParser: def set(self, section, option, value): """Set an option.""" + if not isinstance(value, basestring): + raise TypeError("option values must be strings") if not section or section == DEFAULTSECT: sectdict = self._defaults else: |