diff options
author | Antoine Pitrou <pitrou@free.fr> | 2017-09-18 23:50:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-18 23:50:44 +0200 |
commit | 88c60c9668f0aa732693517a60b851cc1dfce0cb (patch) | |
tree | 60a30eb883118025b6416f566e64598dac8b8a58 /Lib/importlib/_bootstrap.py | |
parent | b43c4caf81b10e5c7ebaeb3a712c6db584f60bbd (diff) | |
download | cpython-git-88c60c9668f0aa732693517a60b851cc1dfce0cb.tar.gz |
Trivial cleanups following bpo-31370 (#3649)
* Trivial cleanups following bpo-31370
* Also cleanup the "importlib._bootstrap_external" module
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r-- | Lib/importlib/_bootstrap.py | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py index fbd9392d41..755a634465 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""" |