summaryrefslogtreecommitdiffstats
path: root/Objects/exceptions.c
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2016-09-07 22:42:32 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2016-09-07 22:42:32 (GMT)
commitc943265ba56e7ce7e2fe79fdecfc6670e10e5467 (patch)
tree3447a25e48844f57e2e8452aad43a3567101cd32 /Objects/exceptions.c
parent86a76684269f940a20366cb42668f1acb0982dca (diff)
downloadcpython-c943265ba56e7ce7e2fe79fdecfc6670e10e5467.zip
cpython-c943265ba56e7ce7e2fe79fdecfc6670e10e5467.tar.gz
cpython-c943265ba56e7ce7e2fe79fdecfc6670e10e5467.tar.bz2
Issue #15767: Add ModuleNotFoundError.
Diffstat (limited to 'Objects/exceptions.c')
-rw-r--r--Objects/exceptions.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index 336c32c..6fb5eb7 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -706,6 +706,13 @@ ComplexExtendsException(PyExc_Exception, ImportError,
"module.");
/*
+ * ModuleNotFoundError extends ImportError
+ */
+
+MiddlingExtendsException(PyExc_ImportError, ModuleNotFoundError, ImportError,
+ "Module not found.");
+
+/*
* OSError extends Exception
*/
@@ -2469,6 +2476,7 @@ _PyExc_Init(PyObject *bltinmod)
PRE_INIT(SystemExit)
PRE_INIT(KeyboardInterrupt)
PRE_INIT(ImportError)
+ PRE_INIT(ModuleNotFoundError)
PRE_INIT(OSError)
PRE_INIT(EOFError)
PRE_INIT(RuntimeError)
@@ -2541,6 +2549,7 @@ _PyExc_Init(PyObject *bltinmod)
POST_INIT(SystemExit)
POST_INIT(KeyboardInterrupt)
POST_INIT(ImportError)
+ POST_INIT(ModuleNotFoundError)
POST_INIT(OSError)
INIT_ALIAS(EnvironmentError, OSError)
INIT_ALIAS(IOError, OSError)