From 5313d7f4890d0cc51c87983de8369e19b1f59da0 Mon Sep 17 00:00:00 2001 From: Windson yang Date: Sun, 9 Dec 2018 09:50:43 +0800 Subject: [PATCH 1/2] bpo-35325:imp.find_module() return value documentation discrepancy --- Doc/library/imp.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst index 1bd6f12b915f89..f264ef0f2e45ca 100644 --- a/Doc/library/imp.rst +++ b/Doc/library/imp.rst @@ -51,7 +51,9 @@ This module provides an interface to the mechanisms used to implement the places are searched: the function tries to find a built-in module with the given name (:const:`C_BUILTIN`), then a frozen module (:const:`PY_FROZEN`), and on some systems some other places are looked in as well (on Windows, it - looks in the registry which may point to a specific file). + looks in the registry which may point to a specific file). If the path in + the built-in module or frozen module, the function will return None for *file* + and *file_path*. Otherwise, *path* must be a list of directory names; each directory is searched for files with any of the suffixes returned by :func:`get_suffixes` @@ -66,12 +68,12 @@ This module provides an interface to the mechanisms used to implement the contained in the list returned by :func:`get_suffixes` describing the kind of module found. - If the module does not live in a file, the returned *file* is ``None``, - *pathname* is the empty string, and the *description* tuple contains empty - strings for its suffix and mode; the module type is indicated as given in - parentheses above. If the search is unsuccessful, :exc:`ImportError` is - raised. Other exceptions indicate problems with the arguments or - environment. + If the module does not live in a file or the path is in the built-in module or + frozen module, the returned *file* is ``None``, *pathname* is the empty string, + and the *description* tuple contains empty strings for its suffix and mode; + the module type is indicated as given in parentheses above. If the search + is unsuccessful, :exc:`ImportError` is raised. Other exceptions indicate + problems with the arguments or environment. If the module is a package, *file* is ``None``, *pathname* is the package path and the last item in the *description* tuple is :const:`PKG_DIRECTORY`. From aabdd11433ddaceef7e37be9e966f0e38b963b24 Mon Sep 17 00:00:00 2001 From: Windsooon Date: Thu, 12 Sep 2019 08:08:19 +0800 Subject: [PATCH 2/2] update depend on reviewer --- Doc/library/imp.rst | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Doc/library/imp.rst b/Doc/library/imp.rst index f264ef0f2e45ca..622ede3e352562 100644 --- a/Doc/library/imp.rst +++ b/Doc/library/imp.rst @@ -51,9 +51,7 @@ This module provides an interface to the mechanisms used to implement the places are searched: the function tries to find a built-in module with the given name (:const:`C_BUILTIN`), then a frozen module (:const:`PY_FROZEN`), and on some systems some other places are looked in as well (on Windows, it - looks in the registry which may point to a specific file). If the path in - the built-in module or frozen module, the function will return None for *file* - and *file_path*. + looks in the registry which may point to a specific file). Otherwise, *path* must be a list of directory names; each directory is searched for files with any of the suffixes returned by :func:`get_suffixes` @@ -68,8 +66,7 @@ This module provides an interface to the mechanisms used to implement the contained in the list returned by :func:`get_suffixes` describing the kind of module found. - If the module does not live in a file or the path is in the built-in module or - frozen module, the returned *file* is ``None``, *pathname* is the empty string, + If the module is built-in or frozen then *file* and *pathname* are both ``None`` and the *description* tuple contains empty strings for its suffix and mode; the module type is indicated as given in parentheses above. If the search is unsuccessful, :exc:`ImportError` is raised. Other exceptions indicate