mirror of
https://github.com/python/cpython.git
synced 2025-09-11 19:27:07 +00:00
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.
This commit is contained in:
parent
1660933d23
commit
b12f0b581a
4 changed files with 19 additions and 3 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue