mirror of
https://github.com/python/cpython.git
synced 2025-09-15 13:16:12 +00:00
Backport 70111: Let configparser use ordered dicts by default.
This commit is contained in:
parent
88a9164cdb
commit
e89b8e9832
3 changed files with 26 additions and 1 deletions
|
@ -87,6 +87,12 @@ ConfigParser -- responsible for parsing a list of
|
|||
write the configuration state in .ini format
|
||||
"""
|
||||
|
||||
try:
|
||||
from collections import OrderedDict as _default_dict
|
||||
except ImportError:
|
||||
# fallback for setup.py which hasn't yet built _collections
|
||||
_default_dict = dict
|
||||
|
||||
import re
|
||||
|
||||
__all__ = ["NoSectionError", "DuplicateSectionError", "NoOptionError",
|
||||
|
@ -215,7 +221,7 @@ class MissingSectionHeaderError(ParsingError):
|
|||
|
||||
|
||||
class RawConfigParser:
|
||||
def __init__(self, defaults=None, dict_type=dict):
|
||||
def __init__(self, defaults=None, dict_type=_default_dict):
|
||||
self._dict = dict_type
|
||||
self._sections = self._dict()
|
||||
self._defaults = self._dict()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue