[Python-checkins] peps: [PEP 451] Don't change the signature of the file-based finders.
eric.snow
python-checkins at python.org
Tue Oct 22 17:41:21 CEST 2013
http://hg.python.org/peps/rev/cf6ea6105d47
changeset: 5205:cf6ea6105d47
user: Eric Snow <ericsnowcurrently at gmail.com>
date: Tue Oct 22 09:37:20 2013 -0600
summary:
[PEP 451] Don't change the signature of the file-based finders.
The "Open Issues" section is also cleaned up.
files:
pep-0451.txt | 39 +++++++++++++++++++--------------------
1 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/pep-0451.txt b/pep-0451.txt
--- a/pep-0451.txt
+++ b/pep-0451.txt
@@ -278,8 +278,9 @@
* spec_from_file_location(name, location, \*, loader=None, submodule_search_locations=None)
- build a spec from file-oriented information and loader APIs.
-* from_loader(name, loader, \*, origin=None, is_package=None) - build
- a spec with missing information filled in by using loader APIs.
+* spec_from_loader(name, loader, \*, origin=None, is_package=None)
+ - build a spec with missing information filled in by using loader
+ APIs.
Other API Additions
-------------------
@@ -313,8 +314,6 @@
* importlib.abc.PathEntryFinder.find_loader()
* importlib.abc.Loader.load_module()
* importlib.abc.Loader.module_repr()
-* The parameters and attributes of the various loaders in
- importlib.machinery
* importlib.util.set_package()
* importlib.util.set_loader()
* importlib.find_loader()
@@ -756,12 +755,6 @@
can use it to populate its own is_package if that information is
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
directly responsible for providing APIs concerning module-related data.
@@ -775,11 +768,10 @@
was started. For instance, with ``-m`` the spec's name will be that
of the run module, while ``__main__.__name__`` will still be
"__main__".
-* We add importlib.find_spec() to mirror
- importlib.find_loader() (which becomes deprecated).
+* We will add importlib.find_spec() to mirror importlib.find_loader()
+ (which becomes deprecated).
* importlib.reload() is changed to use ModuleSpec.load().
-* importlib.reload() will now make use of the per-module import
- lock.
+* importlib.reload() will now make use of the per-module import lock.
Reference Implementation
@@ -792,10 +784,19 @@
Open Issues
==============
-\* The impact of this change on pkgutil (and setuptools) needs looking
-into. It has some generic function-based extensions to PEP 302. These
-may break if importlib starts wrapping loaders without the tools'
-knowledge.
+\* Impact on some kinds of lazy loading modules. [lazy_import_concerns]_
+
+This should not be an issue since the PEP does not change the semantics
+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,
inspect.
@@ -803,8 +804,6 @@
For instance, pickle should be updated in the ``__main__`` case to look
at ``module.__spec__.name``.
-\* Impact on some kinds of lazy loading modules. [lazy_import_concerns]_
-
References
==========
--
Repository URL: http://hg.python.org/peps
More information about the Python-checkins
mailing list