]> granicus.if.org Git - python/commitdiff
Removed some unused imports to decrease the amount of loaded modules during startup.
authorChristian Heimes <christian@cheimes.de>
Fri, 15 Aug 2008 18:43:03 +0000 (18:43 +0000)
committerChristian Heimes <christian@cheimes.de>
Fri, 15 Aug 2008 18:43:03 +0000 (18:43 +0000)
Added fallback to _dummy_thread for OSs w/o thread support.

Lib/io.py
Lib/warnings.py

index 18680cad534758bc36870135c949bb8075338ec8..4fe1e8cb68e58aa6aaf5ef8769941a45b0c3ac57 100644 (file)
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -60,8 +60,12 @@ import abc
 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
index bcd702c99377b55355bc09ca4f5178eb42f39db5..0be20e05e3d0fb4c1830845f58dbdad0165f0975 100644 (file)
@@ -5,7 +5,6 @@
 # See bug 683658.
 import linecache
 import sys
-import types
 
 __all__ = ["warn", "showwarning", "formatwarning", "filterwarnings",
            "resetwarnings"]