Issue #378: Do not use internal importlib._bootstrap module.

parent c87fd7aa
...@@ -6,6 +6,7 @@ CHANGES ...@@ -6,6 +6,7 @@ CHANGES
17.0 17.0
---- ----
* Issue #378: Do not use internal importlib._bootstrap module.
* Issue #390: Disallow console scripts with path separators in * Issue #390: Disallow console scripts with path separators in
the name. Removes unintended functionality and brings behavior the name. Removes unintended functionality and brings behavior
into parity wih pip. into parity wih pip.
......
...@@ -69,9 +69,9 @@ from os.path import isdir, split ...@@ -69,9 +69,9 @@ from os.path import isdir, split
# Avoid try/except due to potential problems with delayed import mechanisms. # Avoid try/except due to potential problems with delayed import mechanisms.
if sys.version_info >= (3, 3) and sys.implementation.name == "cpython": if sys.version_info >= (3, 3) and sys.implementation.name == "cpython":
import importlib._bootstrap as importlib_bootstrap import importlib.machinery as importlib_machinery
else: else:
importlib_bootstrap = None importlib_machinery = None
try: try:
import parser import parser
...@@ -1720,8 +1720,8 @@ class DefaultProvider(EggProvider): ...@@ -1720,8 +1720,8 @@ class DefaultProvider(EggProvider):
register_loader_type(type(None), DefaultProvider) register_loader_type(type(None), DefaultProvider)
if importlib_bootstrap is not None: if importlib_machinery is not None:
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider) register_loader_type(importlib_machinery.SourceFileLoader, DefaultProvider)
class EmptyProvider(NullProvider): class EmptyProvider(NullProvider):
...@@ -2128,8 +2128,8 @@ def find_on_path(importer, path_item, only=False): ...@@ -2128,8 +2128,8 @@ def find_on_path(importer, path_item, only=False):
break break
register_finder(pkgutil.ImpImporter, find_on_path) register_finder(pkgutil.ImpImporter, find_on_path)
if importlib_bootstrap is not None: if importlib_machinery is not None:
register_finder(importlib_bootstrap.FileFinder, find_on_path) register_finder(importlib_machinery.FileFinder, find_on_path)
_declare_state('dict', _namespace_handlers={}) _declare_state('dict', _namespace_handlers={})
_declare_state('dict', _namespace_packages={}) _declare_state('dict', _namespace_packages={})
...@@ -2237,8 +2237,8 @@ def file_ns_handler(importer, path_item, packageName, module): ...@@ -2237,8 +2237,8 @@ def file_ns_handler(importer, path_item, packageName, module):
register_namespace_handler(pkgutil.ImpImporter, file_ns_handler) register_namespace_handler(pkgutil.ImpImporter, file_ns_handler)
register_namespace_handler(zipimport.zipimporter, file_ns_handler) register_namespace_handler(zipimport.zipimporter, file_ns_handler)
if importlib_bootstrap is not None: if importlib_machinery is not None:
register_namespace_handler(importlib_bootstrap.FileFinder, file_ns_handler) register_namespace_handler(importlib_machinery.FileFinder, file_ns_handler)
def null_ns_handler(importer, path_item, packageName, module): def null_ns_handler(importer, path_item, packageName, module):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment