[PEP 451] Don't change the signature of the file-based finders.

The "Open Issues" section is also cleaned up.
This commit is contained in:
Eric Snow 2013-10-22 09:37:20 -06:00
parent 834123996b
commit d57c8be816
1 changed files with 19 additions and 20 deletions

View File

@ -278,8 +278,9 @@ finders. See the `Factory Functions`_ section below for more detail.
* spec_from_file_location(name, location, \*, loader=None, submodule_search_locations=None) * spec_from_file_location(name, location, \*, loader=None, submodule_search_locations=None)
- build a spec from file-oriented information and loader APIs. - build a spec from file-oriented information and loader APIs.
* from_loader(name, loader, \*, origin=None, is_package=None) - build * spec_from_loader(name, loader, \*, origin=None, is_package=None)
a spec with missing information filled in by using loader APIs. - build a spec with missing information filled in by using loader
APIs.
Other API Additions Other API Additions
------------------- -------------------
@ -313,8 +314,6 @@ Deprecations
* importlib.abc.PathEntryFinder.find_loader() * importlib.abc.PathEntryFinder.find_loader()
* importlib.abc.Loader.load_module() * importlib.abc.Loader.load_module()
* importlib.abc.Loader.module_repr() * importlib.abc.Loader.module_repr()
* The parameters and attributes of the various loaders in
importlib.machinery
* importlib.util.set_package() * importlib.util.set_package()
* importlib.util.set_loader() * importlib.util.set_loader()
* importlib.find_loader() * importlib.find_loader()
@ -756,12 +755,6 @@ though the same information is found on ModuleSpec. ModuleSpec
can use it to populate its own is_package if that information is can use it to populate its own is_package if that information is
not otherwise available. Still, it will be made optional. not otherwise available. Still, it will be made optional.
One consequence of ModuleSpec is that loader ``__init__`` methods will
no longer need to accommodate per-module state. The path-based loaders
in importlib take arguments in their ``__init__()`` and have
corresponding attributes. However, the need for those values is
eliminated by module specs.
In addition to executing a module during loading, loaders will still be In addition to executing a module during loading, loaders will still be
directly responsible for providing APIs concerning module-related data. directly responsible for providing APIs concerning module-related data.
@ -775,11 +768,10 @@ Other Changes
was started. For instance, with ``-m`` the spec's name will be that was started. For instance, with ``-m`` the spec's name will be that
of the run module, while ``__main__.__name__`` will still be of the run module, while ``__main__.__name__`` will still be
"__main__". "__main__".
* We add importlib.find_spec() to mirror * We will add importlib.find_spec() to mirror importlib.find_loader()
importlib.find_loader() (which becomes deprecated). (which becomes deprecated).
* importlib.reload() is changed to use ModuleSpec.load(). * importlib.reload() is changed to use ModuleSpec.load().
* importlib.reload() will now make use of the per-module import * importlib.reload() will now make use of the per-module import lock.
lock.
Reference Implementation Reference Implementation
@ -792,10 +784,19 @@ http://bugs.python.org/issue18864.
Open Issues Open Issues
============== ==============
\* The impact of this change on pkgutil (and setuptools) needs looking \* Impact on some kinds of lazy loading modules. [lazy_import_concerns]_
into. It has some generic function-based extensions to PEP 302. These
may break if importlib starts wrapping loaders without the tools' This should not be an issue since the PEP does not change the semantics
knowledge. of this behavior.
Implementation Notes
====================
\* The implementation of this PEP needs to be cognizant of its impact on
pkgutil (and setuptools). pkgutil has some generic function-based
extensions to PEP 302 which may break if importlib starts wrapping
loaders without the tools' knowledge.
\* Other modules to look at: runpy (and pythonrun.c), pickle, pydoc, \* Other modules to look at: runpy (and pythonrun.c), pickle, pydoc,
inspect. inspect.
@ -803,8 +804,6 @@ inspect.
For instance, pickle should be updated in the ``__main__`` case to look For instance, pickle should be updated in the ``__main__`` case to look
at ``module.__spec__.name``. at ``module.__spec__.name``.
\* Impact on some kinds of lazy loading modules. [lazy_import_concerns]_
References References
========== ==========