[Python-checkins] r70118 - python/branches/py3k/Lib/configparser.py

raymond.hettinger python-checkins at python.org
Tue Mar 3 02:32:48 CET 2009


Author: raymond.hettinger
Date: Tue Mar  3 02:32:48 2009
New Revision: 70118

Log:
Fix bootstrapping problem where setup.py was using configparser
before _collections had been built.



Modified:
   python/branches/py3k/Lib/configparser.py

Modified: python/branches/py3k/Lib/configparser.py
==============================================================================
--- python/branches/py3k/Lib/configparser.py	(original)
+++ python/branches/py3k/Lib/configparser.py	Tue Mar  3 02:32:48 2009
@@ -87,8 +87,13 @@
         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
-from collections import OrderedDict
 
 __all__ = ["NoSectionError", "DuplicateSectionError", "NoOptionError",
            "InterpolationError", "InterpolationDepthError",
@@ -216,7 +221,7 @@
 
 
 class RawConfigParser:
-    def __init__(self, defaults=None, dict_type=OrderedDict):
+    def __init__(self, defaults=None, dict_type=_default_dict):
         self._dict = dict_type
         self._sections = self._dict()
         self._defaults = self._dict()


More information about the Python-checkins mailing list