diff Lib/ConfigParser.py @ 32115:84dfa9a67da1 legacy-trunk

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)
author Fred Drake <fdrake@acm.org>
date Tue, 18 May 2004 03:29:52 +0000
parents 70023af2085a
children 29a59f662dd1
line wrap: on
line diff
--- a/Lib/ConfigParser.py	Tue May 18 02:25:51 2004 +0000
+++ b/Lib/ConfigParser.py	Tue May 18 03:29:52 2004 +0000
@@ -343,6 +343,8 @@
 
     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: