.. versionchanged:: 2.6
*dict_type* was added.
+ .. versionchanged:: 2.7
+ The default *dict_type* is :class:`collections.OrderedDict`.
+
.. class:: ConfigParser([defaults[, dict_type]])
option names to lower case), the values ``foo %(bar)s`` and ``foo %(BAR)s`` are
equivalent.
+ .. versionadded:: 2.3
+
+ .. versionchanged:: 2.6
+ *dict_type* was added.
+
+ .. versionchanged:: 2.7
+ The default *dict_type* is :class:`collections.OrderedDict`.
+
.. class:: SafeConfigParser([defaults[, dict_type]])
.. versionadded:: 2.3
+ .. versionchanged:: 2.6
+ *dict_type* was added.
+
+ .. versionchanged:: 2.7
+ The default *dict_type* is :class:`collections.OrderedDict`.
+
.. exception:: NoSectionError
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",
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()
- The _asdict() for method for namedtuples now returns an OrderedDict().
+- The configparser module now defaults to using an ordered dictionary.
+
- Issue #4308: httplib.IncompleteRead's repr doesn't include all of the data all
ready received.