@@ -183,7 +183,8 @@ Importing Modules
183183 single: __all__ (package variable)
184184
185185 This is a simplified interface to :cfunc: `PyImport_ImportModuleEx ` below,
186- leaving the *globals * and *locals * arguments set to *NULL *. When the *name *
186+ leaving the *globals * and *locals * arguments set to *NULL * and *level * set
187+ to 0. When the *name *
187188 argument contains a dot (when it specifies a submodule of a package), the
188189 *fromlist * argument is set to the list ``['*'] `` so that the return value is the
189190 named module rather than the top-level package containing it as would otherwise
@@ -198,9 +199,28 @@ Importing Modules
198199 .. versionchanged :: 2.4
199200 failing imports remove incomplete module objects.
200201
202+ .. versionchanged :: 2.6
203+ always use absolute imports
204+
201205 .. index :: single: modules (in module sys)
202206
203207
208+ .. cfunction :: PyObject* PyImport_ImportModuleNoBlock(const char *name)
209+
210+ .. index ::
211+ single: `cfunc:PyImport_ImportModule `
212+
213+ This version of `cfunc:PyImport_ImportModule ` does not block. It's intended
214+ to be used in C function which import other modules to execute a function.
215+ The import may block if another thread holds the import lock. The function
216+ `cfunc:PyImport_ImportModuleNoBlock ` doesn't block. It first tries to fetch
217+ the module from sys.modules and falls back to `cfunc:PyImport_ImportModule `
218+ unless the the lock is hold. In the latter case the function raises an
219+ ImportError.
220+
221+ .. versionadded :: 2.6
222+
223+
204224.. cfunction :: PyObject* PyImport_ImportModuleEx(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist)
205225
206226 .. index :: builtin: __import__
@@ -218,6 +238,24 @@ Importing Modules
218238 .. versionchanged :: 2.4
219239 failing imports remove incomplete module objects.
220240
241+ .. versionchanged :: 2.6
242+ The function is an alias for `cfunc:PyImport_ImportModuleLevel ` with
243+ -1 as level, meaning relative import.
244+
245+
246+ .. cfunction :: PyObject* PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, PyObject *fromlist, int level)
247+
248+ Import a module. This is best described by referring to the built-in Python
249+ function :func: `__import__ `, as the standard :func: `__import__ ` function calls
250+ this function directly.
251+
252+ The return value is a new reference to the imported module or top-level package,
253+ or *NULL * with an exception set on failure. Like for :func: `__import__ `,
254+ the return value when a submodule of a package was requested is normally the
255+ top-level package, unless a non-empty *fromlist * was given.
256+
257+ ..versionadded:: 2.5
258+
221259
222260.. cfunction :: PyObject* PyImport_Import(PyObject *name)
223261
@@ -230,6 +268,9 @@ Importing Modules
230268 current globals. This means that the import is done using whatever import hooks
231269 are installed in the current environment, e.g. by :mod: `rexec ` or :mod: `ihooks `.
232270
271+ .. versionchanged :: 2.6
272+ always use absolute imports
273+
233274
234275.. cfunction :: PyObject* PyImport_ReloadModule(PyObject *m)
235276
0 commit comments