New submission from Oren Milman:

the proposed changes:
I believe there are some mistakes in the following docstrings:
    1. in Lib/importlib/_bootstrap.py:
        - _module_repr - a typo
        - _exec - I believe 'Execute the module specified by the spec' is more 
accurate than 'Execute the spec'. 
        This docstring wasn't changed since this version of _exec was added in 
revision 90915 (this version of _exec replaced the one that was in 
_SpecMethods), so I guess the exact phrasing of that docstring wasn't already 
challenged.
        - _find_spec - I believe "Find a module's spec." is more accurate than 
"Find a module's loader.", as the function returns a spec and not a loader. It 
might be argued that ultimately the function does find a loader. However, we 
have the perfectly normal case where it is a namespace package, and _find_spec 
doesn't find any loader. 
        This docstring was the docstring of _find_module, and was left as is 
when _find_spec replaced _find_module in revision 87347 (which implemented PEP 
451), so I guess the exact phrasing of that docstring (in the context of 
_find_spec) wasn't already challenged.
    2. in Lib/importlib/_bootstrap_external.py:
        - PathFinder._path_hooks - It seems the function's docstring was left 
as is when issue #14605 was addressed, and thus, since revision 76566, the 
docstring is inaccurate. 
        - PathFinder.find_spec - I believe "Try to find a spec for 'fullname' 
on..." is more accurate than "find the module on..." (I took the phrasing from 
Doc\library\importlib.rst). 
        It seems this docstring was copied from PathFinder.find_module when it 
was added in revision 87347, and was never changed since, so I guess its exact 
phrasing wasn't already challenged. 
        - FileFinder.find_spec - It seems this docstring was copied from 
FileFinder.find_loader when it was added in revision 87347, and was never 
changed since. Again, I took the phrasing of my proposed new docstring from 
Doc\library\importlib.rst.


diff:
The patches diff is attached.


tests:
I played a little with the interpreter, and everything worked as usual. I also 
verified that CPython was indeed compiled with my patched frozen modules (made 
by _freeze_importlib.exe), by reading patched docstrings interactively via 
'import _frozen_importlib' and 'import _frozen_importlib_external'.

In addition, I run 'python -m test' (on my 64-bit Windows 10) before and after 
applying the patch, and got quite the same output.
the outputs of both runs are attached.

----------
components: Library (Lib)
files: issue.diff
keywords: patch
messages: 265076
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: mistakes in docstrings in the import machinery
versions: Python 3.6
Added file: http://bugs.python.org/file42770/issue.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26972>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to