[Python-checkins] cpython: Issue #26972: Fix some mistakes in importlib-related docstrings.
brett.cannon
python-checkins at python.org
Fri Jul 8 14:09:39 EDT 2016
https://hg.python.org/cpython/rev/d32517de5d8c
changeset: 102290:d32517de5d8c
user: Brett Cannon <brett at python.org>
date: Fri Jul 08 11:09:35 2016 -0700
summary:
Issue #26972: Fix some mistakes in importlib-related docstrings.
Thanks to Oren Milman for the patch.
files:
Lib/importlib/_bootstrap.py | 6 ++--
Lib/importlib/_bootstrap_external.py | 18 ++++++++--------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -270,7 +270,7 @@
# Module specifications #######################################################
def _module_repr(module):
- # The implementation of ModuleType__repr__().
+ # The implementation of ModuleType.__repr__().
loader = getattr(module, '__loader__', None)
if hasattr(loader, 'module_repr'):
# As soon as BuiltinImporter, FrozenImporter, and NamespaceLoader
@@ -603,7 +603,7 @@
# Used by importlib.reload() and _load_module_shim().
def _exec(spec, module):
- """Execute the spec in an existing module's namespace."""
+ """Execute the spec's specified module in an existing module's namespace."""
name = spec.name
_imp.acquire_lock()
with _ModuleLockManager(name):
@@ -877,7 +877,7 @@
def _find_spec(name, path, target=None):
- """Find a module's loader."""
+ """Find a module's spec."""
meta_path = sys.meta_path
if meta_path is None:
# PyImport_Cleanup() is running or has been called.
diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -1048,11 +1048,7 @@
@classmethod
def _path_hooks(cls, path):
- """Search sequence of hooks for a finder for 'path'.
-
- If 'hooks' is false then use sys.path_hooks.
-
- """
+ """Search sys.path_hooks for a finder for 'path'."""
if sys.path_hooks is not None and not sys.path_hooks:
_warnings.warn('sys.path_hooks is empty', ImportWarning)
for hook in sys.path_hooks:
@@ -1134,8 +1130,10 @@
@classmethod
def find_spec(cls, fullname, path=None, target=None):
- """find the module on sys.path or 'path' based on sys.path_hooks and
- sys.path_importer_cache."""
+ """Try to find a spec for 'fullname' on sys.path or 'path'.
+
+ The search is based on sys.path_hooks and sys.path_importer_cache.
+ """
if path is None:
path = sys.path
spec = cls._get_spec(fullname, path, target)
@@ -1215,8 +1213,10 @@
submodule_search_locations=smsl)
def find_spec(self, fullname, target=None):
- """Try to find a spec for the specified module. Returns the
- matching spec, or None if not found."""
+ """Try to find a spec for the specified module.
+
+ Returns the matching spec, or None if not found.
+ """
is_namespace = False
tail_module = fullname.rpartition('.')[2]
try:
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list