From f4f25fe576ca86a51c8e4f98a801f32879d7a582 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Fri, 4 Dec 2015 14:51:26 -0800 Subject: [PATCH] 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. --- Doc/reference/import.rst | 9 ++++----- Misc/NEWS | 6 ++++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Doc/reference/import.rst b/Doc/reference/import.rst index d549b2674e8..2144c1fa356 100644 --- a/Doc/reference/import.rst +++ b/Doc/reference/import.rst @@ -29,11 +29,10 @@ such as the importing of parent packages, and the updating of various caches a name binding operation. When calling :func:`__import__` as part of an import statement, the -import system first checks the module global namespace for a function by -that name. If it is not found, then the standard builtin :func:`__import__` -is called. Other mechanisms for invoking the import system (such as -:func:`importlib.import_module`) do not perform this check and will always -use the standard import system. +standard builtin :func:`__import__` is called. Other mechanisms for +invoking the import system (such as :func:`importlib.import_module`) may +choose to subvert :func:`__import__` and use its own solution to +implement import semantics. When a module is first imported, Python searches for the module and if found, it creates a module object [#fnmo]_, initializing it. If the named module diff --git a/Misc/NEWS b/Misc/NEWS index 6dae17d196b..41917804986 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -54,6 +54,12 @@ Library - Issue #25624: ZipFile now always writes a ZIP_STORED header for directory entries. Patch by Dingyuan Wang. +Documentation +------------- + +- Issue #25500: Fix documentation to not claim that __import__ is searched for + in the global scope. + Tests -----