mirror of
https://github.com/python/cpython.git
synced 2025-10-11 17:32:49 +00:00
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:
parent
bc12b01d83
commit
abc086fb0d
3 changed files with 36 additions and 1 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue