summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-03-21 20:55:20 (GMT)
committerGeorg Brandl <georg@python.org>2008-03-21 20:55:20 (GMT)
commit4ab9febddea82d1647d16473157f2ff05802fb30 (patch)
treeb97c9128af9c657f35913630ef1a0d4778d3578f /Doc/c-api
parent65bb42dc1be3afe9ad0e5413b7843cc65d9d3a37 (diff)
downloadcpython-4ab9febddea82d1647d16473157f2ff05802fb30.zip
cpython-4ab9febddea82d1647d16473157f2ff05802fb30.tar.gz
cpython-4ab9febddea82d1647d16473157f2ff05802fb30.tar.bz2
#2160: document PyImport_GetImporter.
Diffstat (limited to 'Doc/c-api')
-rw-r--r--Doc/c-api/import.rst13
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/c-api/import.rst b/Doc/c-api/import.rst
index da8ef06..c4816f5 100644
--- a/Doc/c-api/import.rst
+++ b/Doc/c-api/import.rst
@@ -161,6 +161,19 @@ Importing Modules
``sys.modules``). Note that this is a per-interpreter variable.
+.. cfunction:: PyObject* PyImport_GetImporter(PyObject *path)
+
+ Return an importer object for a :data:`sys.path`/:attr:`pkg.__path__` item
+ *path*, possibly by fetching it from the :data:`sys.path_importer_cache`
+ dict. If it wasn't yet cached, traverse :data:`sys.path_hooks` until a hook
+ is found that can handle the path item. Return ``None`` if no hook could;
+ this tells our caller it should fall back to the builtin import mechanism.
+ Cache the result in :data:`sys.path_importer_cache`. Return a new reference
+ to the importer object.
+
+ .. versionadded:: 2.6
+
+
.. cfunction:: void _PyImport_Init()
Initialize the import mechanism. For internal use only.