diff options
author | Brett Cannon <brett@python.org> | 2013-06-13 03:29:18 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-06-13 03:29:18 (GMT) |
commit | 8f5ac5106eb24dd8bda91f25e993a90a820a2d5c (patch) | |
tree | 49b910fbfa1af58f0c017d42c84d507b338d7bb2 /Doc/library/exceptions.rst | |
parent | 3e9a9ae09d6fc9169b01cba3efd1ae03ab40b237 (diff) | |
download | cpython-8f5ac5106eb24dd8bda91f25e993a90a820a2d5c.zip cpython-8f5ac5106eb24dd8bda91f25e993a90a820a2d5c.tar.gz cpython-8f5ac5106eb24dd8bda91f25e993a90a820a2d5c.tar.bz2 |
Issue #15767: Touch up ModuleNotFoundError usage by import.
Forgot to raise ModuleNotFoundError when None is found in sys.modules.
This led to introducing the C function PyErr_SetImportErrorSubclass()
to make setting ModuleNotFoundError easier.
Also updated the reference docs to mention ModuleNotFoundError
appropriately. Updated the docs for ModuleNotFoundError to mention the
None in sys.modules case.
Lastly, it was noticed that PyErr_SetImportError() was not setting an
exception when returning None in one case. That issue is now fixed.
Diffstat (limited to 'Doc/library/exceptions.rst')
-rw-r--r-- | Doc/library/exceptions.rst | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index 933667c..377d98a 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -185,7 +185,8 @@ The following exceptions are the exceptions that are usually raised. A subclass of :exc:`ImportError` which is raised by :keyword:`import` when a module could not be located. This includes ``from ... import`` statements as the specific attribute being requested cannot be known a priori to be a module - or some other type of object. + or some other type of object. It is also raised when ``None`` is found in + :data:`sys.modules`. .. versionadded:: 3.4 |