summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/_pydecimal.py5
-rw-r--r--Lib/importlib/_bootstrap.py14
-rw-r--r--Lib/importlib/_bootstrap_external.py6
-rw-r--r--Lib/test/ssl_servers.py2
-rw-r--r--Lib/test/support/__init__.py1
-rw-r--r--Lib/test/test_httplib.py3
-rw-r--r--Lib/test/test_idle.py2
-rw-r--r--Lib/test/test_multiprocessing_main_handling.py3
-rw-r--r--Lib/test/test_thread.py2
-rw-r--r--Lib/test/test_threadsignals.py2
-rw-r--r--Lib/test/test_tools/test_sundry.py1
-rw-r--r--Lib/test/test_winreg.py2
-rw-r--r--Lib/test/test_wsgiref.py2
-rw-r--r--Lib/test/test_xmlrpc.py8
14 files changed, 12 insertions, 41 deletions
diff --git a/Lib/_pydecimal.py b/Lib/_pydecimal.py
index a43c75f..a1662bb 100644
--- a/Lib/_pydecimal.py
+++ b/Lib/_pydecimal.py
@@ -431,10 +431,7 @@ _rounding_modes = (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_CEILING,
##### Context Functions ##################################################
# The getcontext() and setcontext() function manage access to a thread-local
-# current context. Py2.4 offers direct support for thread locals. If that
-# is not available, use threading.current_thread() which is slower but will
-# work for older Pythons. If threads are not part of the build, create a
-# mock threading object with threading.local() returning the module namespace.
+# current context.
import threading
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index fbd9392..755a634 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -1121,25 +1121,13 @@ def _setup(sys_module, _imp_module):
# Directly load built-in modules needed during bootstrap.
self_module = sys.modules[__name__]
- for builtin_name in ('_warnings',):
+ for builtin_name in ('_thread', '_warnings', '_weakref'):
if builtin_name not in sys.modules:
builtin_module = _builtin_from_name(builtin_name)
else:
builtin_module = sys.modules[builtin_name]
setattr(self_module, builtin_name, builtin_module)
- # Directly load the _thread module (needed during bootstrap).
- try:
- thread_module = _builtin_from_name('_thread')
- except ImportError:
- # Python was built without threads
- thread_module = None
- setattr(self_module, '_thread', thread_module)
-
- # Directly load the _weakref module (needed during bootstrap).
- weakref_module = _builtin_from_name('_weakref')
- setattr(self_module, '_weakref', weakref_module)
-
def _install(sys_module, _imp_module):
"""Install importers for builtin and frozen modules"""
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index 3235404..e9f870b 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -1411,11 +1411,7 @@ def _setup(_bootstrap_module):
setattr(self_module, 'path_separators', ''.join(path_separators))
# Directly load the _thread module (needed during bootstrap).
- try:
- thread_module = _bootstrap._builtin_from_name('_thread')
- except ImportError:
- # Python was built without threads
- thread_module = None
+ thread_module = _bootstrap._builtin_from_name('_thread')
setattr(self_module, '_thread', thread_module)
# Directly load the _weakref module (needed during bootstrap).
diff --git a/Lib/test/ssl_servers.py b/Lib/test/ssl_servers.py
index 8146467..bfe533c 100644
--- a/Lib/test/ssl_servers.py
+++ b/Lib/test/ssl_servers.py
@@ -2,13 +2,13 @@ import os
import sys
import ssl
import pprint
+import threading
import urllib.parse
# Rename HTTPServer to _HTTPServer so as to avoid confusion with HTTPSServer.
from http.server import (HTTPServer as _HTTPServer,
SimpleHTTPRequestHandler, BaseHTTPRequestHandler)
from test import support
-threading = support.import_module("threading")
here = os.path.dirname(__file__)
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index b2e4560..4f60507 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -2060,7 +2060,6 @@ def threading_cleanup(*original_values):
def reap_threads(func):
"""Use this function when threads are being used. This will
ensure that the threads are cleaned up even when the test fails.
- If threading is unavailable this function does nothing.
"""
@functools.wraps(func)
def decorator(*args):
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index ab798a2..bec994e 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -5,6 +5,7 @@ import itertools
import os
import array
import socket
+import threading
import unittest
TestCase = unittest.TestCase
@@ -1077,8 +1078,6 @@ class BasicTest(TestCase):
def test_response_fileno(self):
# Make sure fd returned by fileno is valid.
- threading = support.import_module("threading")
-
serv = socket.socket(
socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP)
self.addCleanup(serv.close)
diff --git a/Lib/test/test_idle.py b/Lib/test/test_idle.py
index b7ef70d..31fffd9 100644
--- a/Lib/test/test_idle.py
+++ b/Lib/test/test_idle.py
@@ -1,7 +1,7 @@
import unittest
from test.support import import_module
-# Skip test if _thread or _tkinter wasn't built, if idlelib is missing,
+# Skip test if _tkinter wasn't built, if idlelib is missing,
# or if tcl/tk is not the 8.5+ needed for ttk widgets.
tk = import_module('tkinter') # imports _tkinter
if tk.TkVersion < 8.5:
diff --git a/Lib/test/test_multiprocessing_main_handling.py b/Lib/test/test_multiprocessing_main_handling.py
index a9c5d69..fd93184 100644
--- a/Lib/test/test_multiprocessing_main_handling.py
+++ b/Lib/test/test_multiprocessing_main_handling.py
@@ -1,7 +1,6 @@
# tests __main__ module handling in multiprocessing
from test import support
-# Skip tests if _thread or _multiprocessing wasn't built.
-support.import_module('_thread')
+# Skip tests if _multiprocessing wasn't built.
support.import_module('_multiprocessing')
import importlib
diff --git a/Lib/test/test_thread.py b/Lib/test/test_thread.py
index 52f6c79..64ffe46 100644
--- a/Lib/test/test_thread.py
+++ b/Lib/test/test_thread.py
@@ -2,7 +2,7 @@ import os
import unittest
import random
from test import support
-thread = support.import_module('_thread')
+import _thread as thread
import time
import sys
import weakref
diff --git a/Lib/test/test_threadsignals.py b/Lib/test/test_threadsignals.py
index f93dd77..67a1c58 100644
--- a/Lib/test/test_threadsignals.py
+++ b/Lib/test/test_threadsignals.py
@@ -5,7 +5,7 @@ import signal
import os
import sys
from test import support
-thread = support.import_module('_thread')
+import _thread as thread
import time
if (sys.platform[:3] == 'win'):
diff --git a/Lib/test/test_tools/test_sundry.py b/Lib/test/test_tools/test_sundry.py
index 39e541b..2f9db94 100644
--- a/Lib/test/test_tools/test_sundry.py
+++ b/Lib/test/test_tools/test_sundry.py
@@ -40,7 +40,6 @@ class TestSundryScripts(unittest.TestCase):
for name in self.windows_only:
import_tool(name)
- @unittest.skipIf(not support.threading, "test requires _thread module")
def test_analyze_dxp_import(self):
if hasattr(sys, 'getdxp'):
import_tool('analyze_dxp')
diff --git a/Lib/test/test_winreg.py b/Lib/test/test_winreg.py
index 2be61ae..11d054e 100644
--- a/Lib/test/test_winreg.py
+++ b/Lib/test/test_winreg.py
@@ -4,7 +4,7 @@
import os, sys, errno
import unittest
from test import support
-threading = support.import_module("threading")
+import threading
from platform import machine
# Do this first so test will be skipped if module doesn't exist
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py
index 7708e20..8422b30 100644
--- a/Lib/test/test_wsgiref.py
+++ b/Lib/test/test_wsgiref.py
@@ -18,6 +18,7 @@ import os
import re
import signal
import sys
+import threading
import unittest
@@ -253,7 +254,6 @@ class IntegrationTests(TestCase):
# BaseHandler._write() and _flush() have to write all data, even if
# it takes multiple send() calls. Test this by interrupting a send()
# call with a Unix signal.
- threading = support.import_module("threading")
pthread_kill = support.get_attribute(signal, "pthread_kill")
def app(environ, start_response):
diff --git a/Lib/test/test_xmlrpc.py b/Lib/test/test_xmlrpc.py
index c9099e0..15b7ae5 100644
--- a/Lib/test/test_xmlrpc.py
+++ b/Lib/test/test_xmlrpc.py
@@ -1175,13 +1175,7 @@ class GzipUtilTestCase(unittest.TestCase):
class ServerProxyTestCase(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
- if threading:
- self.url = URL
- else:
- # Without threading, http_server() and http_multi_server() will not
- # be executed and URL is still equal to None. 'http://' is a just
- # enough to choose the scheme (HTTP)
- self.url = 'http://'
+ self.url = URL
def test_close(self):
p = xmlrpclib.ServerProxy(self.url)