[Python-checkins] r61718 - python/trunk/Doc/c-api/import.rst

georg.brandl python-checkins at python.org
Fri Mar 21 21:55:20 CET 2008


Author: georg.brandl
Date: Fri Mar 21 21:55:20 2008
New Revision: 61718

Modified:
   python/trunk/Doc/c-api/import.rst
Log:
#2160: document PyImport_GetImporter.


Modified: python/trunk/Doc/c-api/import.rst
==============================================================================
--- python/trunk/Doc/c-api/import.rst	(original)
+++ python/trunk/Doc/c-api/import.rst	Fri Mar 21 21:55:20 2008
@@ -161,6 +161,19 @@
    ``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.


More information about the Python-checkins mailing list