Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4f25fe

Browse files
committed
Issue #25500: Fix the language reference to not claim that import
statements search for __import__ in the global scope. Thanks to Sergei Lebedev for finding the documentation bug.
1 parent f17c200 commit f4f25fe

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

Doc/reference/import.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,10 @@ such as the importing of parent packages, and the updating of various caches
2929
a name binding operation.
3030

3131
When calling :func:`__import__` as part of an import statement, the
32-
import system first checks the module global namespace for a function by
33-
that name. If it is not found, then the standard builtin :func:`__import__`
34-
is called. Other mechanisms for invoking the import system (such as
35-
:func:`importlib.import_module`) do not perform this check and will always
36-
use the standard import system.
32+
standard builtin :func:`__import__` is called. Other mechanisms for
33+
invoking the import system (such as :func:`importlib.import_module`) may
34+
choose to subvert :func:`__import__` and use its own solution to
35+
implement import semantics.
3736

3837
When a module is first imported, Python searches for the module and if found,
3938
it creates a module object [#fnmo]_, initializing it. If the named module

Misc/NEWS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ Library
5454
- Issue #25624: ZipFile now always writes a ZIP_STORED header for directory
5555
entries. Patch by Dingyuan Wang.
5656

57+
Documentation
58+
-------------
59+
60+
- Issue #25500: Fix documentation to not claim that __import__ is searched for
61+
in the global scope.
62+
5763
Tests
5864
-----
5965

0 commit comments

Comments
 (0)