From: Christian Heimes Date: Fri, 15 Aug 2008 18:43:03 +0000 (+0000) Subject: Removed some unused imports to decrease the amount of loaded modules during startup. X-Git-Tag: v3.0b3~103 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=deb75f579b597d996734f66f93a2303bc7ac4fab;p=python Removed some unused imports to decrease the amount of loaded modules during startup. Added fallback to _dummy_thread for OSs w/o thread support. --- diff --git a/Lib/io.py b/Lib/io.py index 18680cad53..4fe1e8cb68 100644 --- 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 diff --git a/Lib/warnings.py b/Lib/warnings.py index bcd702c993..0be20e05e3 100644 --- a/Lib/warnings.py +++ b/Lib/warnings.py @@ -5,7 +5,6 @@ # See bug 683658. import linecache import sys -import types __all__ = ["warn", "showwarning", "formatwarning", "filterwarnings", "resetwarnings"]