summaryrefslogtreecommitdiff
path: root/Lib/ConfigParser.py
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2004-05-18 03:29:52 +0000
committerFred Drake <fdrake@acm.org>2004-05-18 03:29:52 +0000
commitaeeb22dd4af9be9b89fda10397db44a6a71a097d (patch)
treee9b93105e8f561bdb7e02043a2ad6d6174b64551 /Lib/ConfigParser.py
parent6c73353822fb8566d64db143f0456b682d74236a (diff)
downloadcpython-aeeb22dd4af9be9b89fda10397db44a6a71a097d.tar.gz
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.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py
index 73acdd15ad..fccfcdfea6 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: