summaryrefslogtreecommitdiffstats
path: root/Doc/c-api
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-13 03:29:18 (GMT)
committerBrett Cannon <brett@python.org>2013-06-13 03:29:18 (GMT)
commit8f5ac5106eb24dd8bda91f25e993a90a820a2d5c (patch)
tree49b910fbfa1af58f0c017d42c84d507b338d7bb2 /Doc/c-api
parent3e9a9ae09d6fc9169b01cba3efd1ae03ab40b237 (diff)
downloadcpython-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/c-api')
-rw-r--r--Doc/c-api/exceptions.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/c-api/exceptions.rst b/Doc/c-api/exceptions.rst
index 1bdcdd3..25e2a1c 100644
--- a/Doc/c-api/exceptions.rst
+++ b/Doc/c-api/exceptions.rst
@@ -292,6 +292,13 @@ in various ways. There is a separate error indicator for each thread.
.. versionadded:: 3.3
+.. c:function:: PyObject* PyErr_SetImportErrorSubclass(PyObject *msg, PyObject *name, PyObject *path)
+
+ Much like :c:func:`PyErr_SetImportError` but this function allows for
+ specifying a subclass of :exc:`ImportError` to raise.
+
+ .. versionadded:: 3.4
+
.. c:function:: void PyErr_SyntaxLocationEx(char *filename, int lineno, int col_offset)