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)
This commit is contained in:
Fred Drake 2004-05-18 03:29:52 +00:00
parent bc12b01d83
commit abc086fb0d
3 changed files with 36 additions and 1 deletions

View file

@ -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: