This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Oren Milman
Recipients Oren Milman
Date 2016-04-30.20:01:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1462046496.61.0.778323150916.issue26896@psf.upfronthosting.co.za>
In-reply-to
Content
the proposed changes:
1. it seems there is some mix-up with the terms 'importer' and 'finder' (and rarely also 'loader') in the import system and in related code (I guess most of it is just relics from the time before PEP 302).
The rational is simply https://docs.python.org/3/glossary.html#term-importer, which means (as I understand it) that the only place where 'importer' is appropriate is where the described object is guaranteed to be both a finder and loader object (i.e. currently only any of the following: BuiltinImporter, FrozenImporter, ZipImporter, mock_modules, mock_spec, TestingImporter).

Note: At first I pondered about also changing local variable names and even the name of a static C function, so I posted a question to the core-mentorship mailing list, and ultimately accepted (of course) the answer - https://mail.python.org/mailman/private/core-mentorship/2016-April/003541.html - fix only docs.

these proposed changes are in the following files:
    - Python/import.c (also changed the line saying that get_path_importer returning None tells the caller it should fall back to the built-in import mechanism, as it is no longer true, according to https://docs.python.org/3/reference/import.html#path-entry-finders. As I understand it, the last is indeed the right one)
    - Doc/c-api/import.rst (also changed the parallel doc of the aforementioned comment in Python/import.c)
    - Lib/pkgutil.py
    - Doc/Library/pkgutil.rst
    - Lib/runpy.py (also changed the function comment of _get_module_details, which specified wrong return values)
    - Lib/test/test_pkgutil.py
    

2. While scanning every CPython file that contains the string 'importer', Anaconda (a Sublime Package for Python) found two local variable assignments which were never used. I commented both out (and added a comment stating why). I would be happy to change those two tiny fixes if needed. 

these proposed changes are in the following files:
    - Lib/test/test_importlib/import_/test_meta_path.py
    - Lib/test/test_importlib/util.py


diff:
The patches diff is attached.


tests:
I built the changed *.rst files, and they looked fine.

I played a little with the interpreter, and everything worked as usual.
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.
History
Date User Action Args
2016-04-30 20:01:37Oren Milmansetrecipients: + Oren Milman
2016-04-30 20:01:36Oren Milmansetmessageid: <1462046496.61.0.778323150916.issue26896@psf.upfronthosting.co.za>
2016-04-30 20:01:36Oren Milmanlinkissue26896 messages
2016-04-30 20:01:35Oren Milmancreate