[Python-3000-checkins] r65694 - in python/branches/py3k/Lib: io.py warnings.py

christian.heimes python-3000-checkins at python.org
Fri Aug 15 20:43:03 CEST 2008


Author: christian.heimes
Date: Fri Aug 15 20:43:03 2008
New Revision: 65694

Log:
Removed some unused imports to decrease the amount of loaded modules during startup.
Added fallback to _dummy_thread for OSs w/o thread support.

Modified:
   python/branches/py3k/Lib/io.py
   python/branches/py3k/Lib/warnings.py

Modified: python/branches/py3k/Lib/io.py
==============================================================================
--- python/branches/py3k/Lib/io.py	(original)
+++ python/branches/py3k/Lib/io.py	Fri Aug 15 20:43:03 2008
@@ -60,8 +60,12 @@
 import sys
 import codecs
 import _fileio
-import warnings
-from _thread import allocate_lock as Lock
+# Import _thread instead of threading to reduce startup cost
+try:
+    from _thread import allocate_lock as Lock
+except ImportError:
+    from _dummy_thread import allocate_lock as Lock
+
 
 # open() uses st_blksize whenever we can
 DEFAULT_BUFFER_SIZE = 8 * 1024  # bytes

Modified: python/branches/py3k/Lib/warnings.py
==============================================================================
--- python/branches/py3k/Lib/warnings.py	(original)
+++ python/branches/py3k/Lib/warnings.py	Fri Aug 15 20:43:03 2008
@@ -5,7 +5,6 @@
 # See bug 683658.
 import linecache
 import sys
-import types
 
 __all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
            "resetwarnings"]


More information about the Python-3000-checkins mailing list