summaryrefslogtreecommitdiffstats
path: root/Doc/library/importlib.rst
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2015-05-23 12:24:10 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2015-05-23 12:24:10 (GMT)
commitd5cacbb1d9c3edc02bf0ba01702e7c06da5bc318 (patch)
treee92dda9e119e043482b0aa0ad1fdefff785d54c0 /Doc/library/importlib.rst
parentec219ba1c04c4514b8b004239b1a0eac914dde4a (diff)
downloadcpython-d5cacbb1d9c3edc02bf0ba01702e7c06da5bc318.zip
cpython-d5cacbb1d9c3edc02bf0ba01702e7c06da5bc318.tar.gz
cpython-d5cacbb1d9c3edc02bf0ba01702e7c06da5bc318.tar.bz2
PEP 489: Multi-phase extension module initialization
Known limitations of the current implementation: - documentation changes are incomplete - there's a reference leak I haven't tracked down yet The leak is most visible by running: ./python -m test -R3:3 test_importlib However, you can also see it by running: ./python -X showrefcount Importing the array or _testmultiphase modules, and then deleting them from both sys.modules and the local namespace shows significant increases in the total number of active references each cycle. By contrast, with _testcapi (which continues to use single-phase initialisation) the global refcounts stabilise after a couple of cycles.
Diffstat (limited to 'Doc/library/importlib.rst')
-rw-r--r--Doc/library/importlib.rst28
1 files changed, 19 insertions, 9 deletions
diff --git a/Doc/library/importlib.rst b/Doc/library/importlib.rst
index 07d8ae1..771c4c5 100644
--- a/Doc/library/importlib.rst
+++ b/Doc/library/importlib.rst
@@ -55,6 +55,12 @@ generically as an :term:`importer`) to participate in the import process.
:pep:`451`
A ModuleSpec Type for the Import System
+ :pep:`488`
+ Elimination of PYO files
+
+ :pep:`489`
+ Multi-phase extension module initialization
+
:pep:`3120`
Using UTF-8 as the Default Source Encoding
@@ -756,9 +762,9 @@ find and load modules.
Only class methods are defined by this class to alleviate the need for
instantiation.
- .. note::
- Due to limitations in the extension module C-API, for now
- BuiltinImporter does not implement :meth:`Loader.exec_module`.
+ .. versionchanged:: 3.5
+ As part of :pep:`489`, the builtin importer now implements
+ :meth:`Loader.create_module` and :meth:`Loader.exec_module`
.. class:: FrozenImporter
@@ -973,14 +979,18 @@ find and load modules.
Path to the extension module.
- .. method:: load_module(name=None)
+ .. method:: create_module(spec)
+
+ Creates the module object from the given specification in accordance
+ with :pep:`489`.
+
+ .. versionadded:: 3.5
+
+ .. method:: exec_module(module)
- Loads the extension module if and only if *fullname* is the same as
- :attr:`name` or is ``None``.
+ Initializes the given module object in accordance with :pep:`489`.
- .. note::
- Due to limitations in the extension module C-API, for now
- ExtensionFileLoader does not implement :meth:`Loader.exec_module`.
+ .. versionadded:: 3.5
.. method:: is_package(fullname)