@@ -22,10 +22,8 @@ Importing Modules
2222 be the case. (Unfortunately, this has an additional side effect when *name * in
2323 fact specifies a subpackage instead of a submodule: the submodules specified in
2424 the package's ``__all__ `` variable are loaded.) Return a new reference to the
25- imported module, or *NULL * with an exception set on failure. Before Python 2.4,
26- the module may still be created in the failure case --- examine ``sys.modules ``
27- to find out. Starting with Python 2.4, a failing import of a module no longer
28- leaves the module in ``sys.modules ``.
25+ imported module, or *NULL * with an exception set on failure. A failing
26+ import of a module doesn't leave the module in :data: `sys.modules `.
2927
3028
3129.. cfunction :: PyObject* PyImport_ImportModuleNoBlock(const char *name)
@@ -47,11 +45,11 @@ Importing Modules
4745 function :func: `__import__ `, as the standard :func: `__import__ ` function calls
4846 this function directly.
4947
50- The return value is a new reference to the imported module or top-level package,
51- or *NULL * with an exception set on failure (before Python 2.4, the module may
52- still be created in this case). Like for :func: `__import__ `, the return value
53- when a submodule of a package was requested is normally the top-level package,
54- unless a non-empty * fromlist * was given.
48+ The return value is a new reference to the imported module or top-level
49+ package, or *NULL * with an exception set on failure. Like for
50+ :func: `__import__ `, the return value when a submodule of a package was
51+ requested is normally the top-level package, unless a non-empty * fromlist *
52+ was given.
5553
5654 Failing imports remove incomplete module objects, like with
5755 :cfunc: `PyImport_ImportModule `.
@@ -106,9 +104,8 @@ Importing Modules
106104 Given a module name (possibly of the form ``package.module ``) and a code object
107105 read from a Python bytecode file or obtained from the built-in function
108106 :func: `compile `, load the module. Return a new reference to the module object,
109- or *NULL * with an exception set if an error occurred. Before Python 2.4, the
110- module could still be created in error cases. Starting with Python 2.4, *name *
111- is removed from :attr: `sys.modules ` in error cases, and even if *name * was already
107+ or *NULL * with an exception set if an error occurred. *name *
108+ is removed from :attr: `sys.modules ` in error cases, even if *name * was already
112109 in :attr: `sys.modules ` on entry to :cfunc: `PyImport_ExecCodeModule `. Leaving
113110 incompletely initialized modules in :attr: `sys.modules ` is dangerous, as imports of
114111 such modules have no way to know that the module object is an unknown (and
@@ -144,8 +141,6 @@ Importing Modules
144141 Cache the result in :data: `sys.path_importer_cache `. Return a new reference
145142 to the importer object.
146143
147- .. versionadded :: 2.6
148-
149144
150145.. cfunction :: void _PyImport_Init()
151146
0 commit comments