summaryrefslogtreecommitdiffstats
path: root/Lib/ConfigParser.py
diff options
context:
space:
mode:
authorFacundo Batista <facundobatista@gmail.com>2008-02-23 12:46:10 (GMT)
committerFacundo Batista <facundobatista@gmail.com>2008-02-23 12:46:10 (GMT)
commitb12f0b581a6f268d0611c87012d1273aeca220b8 (patch)
tree15cd0ffb90086c018c9542aa516b988aff18bde1 /Lib/ConfigParser.py
parent1660933d23ed99393c2ea9bbe0204318936e3bbc (diff)
downloadcpython-b12f0b581a6f268d0611c87012d1273aeca220b8.zip
cpython-b12f0b581a6f268d0611c87012d1273aeca220b8.tar.gz
cpython-b12f0b581a6f268d0611c87012d1273aeca220b8.tar.bz2
Issue 1781. Now ConfigParser.add_section does not let you add a
DEFAULT section any more, because it duplicated sections with the rest of the machinery. Thanks Tim Lesher and Manuel Kaufmann.
Diffstat (limited to 'Lib/ConfigParser.py')
-rw-r--r--Lib/ConfigParser.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/ConfigParser.py b/Lib/ConfigParser.py
index 131d697..65c6ae2 100644
--- a/Lib/ConfigParser.py
+++ b/Lib/ConfigParser.py
@@ -235,8 +235,12 @@ class RawConfigParser:
"""Create a new section in the configuration.
Raise DuplicateSectionError if a section by the specified name
- already exists.
+ already exists. Raise ValueError if name is DEFAULT or any of it's
+ case-insensitive variants.
"""
+ if section.lower() == "default":
+ raise ValueError, 'Invalid section name: %s' % section
+
if section in self._sections:
raise DuplicateSectionError(section)
self._sections[section] = self._dict()