From 757df6e4cd0578ed86db188a2331a4e83764c42c Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sun, 30 Aug 2009 04:00:12 +0000 Subject: [PATCH] Document the import semantics that if None is found in sys.modules for a module then ImportError is raised. --- Doc/reference/simple_stmts.rst | 4 +++- Misc/NEWS | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Doc/reference/simple_stmts.rst b/Doc/reference/simple_stmts.rst index 2a34b69e35..7387da72e9 100644 --- a/Doc/reference/simple_stmts.rst +++ b/Doc/reference/simple_stmts.rst @@ -668,7 +668,9 @@ Once the name of the module is known (unless otherwise specified, the term "module" will refer to both packages and modules), searching for the module or package can begin. The first place checked is :data:`sys.modules`, the cache of all modules that have been imported -previously. If the module is found there then it is used in step (2) of import. +previously. If the module is found there then it is used in step (2) of import +unless :keyword:`None` is found in :data:`sys.modules`, in which case +:exc:`ImportError` is raised. .. index:: single: sys.meta_path diff --git a/Misc/NEWS b/Misc/NEWS index ea061a7864..5189aae4ec 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -174,6 +174,9 @@ Build Documenation ------------ +- Document that importing a module that has None in sys.modules triggers an + ImportError. + - Issue #6556: Fixed the Distutils configuration files location explanation for Windows. -- 2.50.0