Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bd43974

Browse files
committed
Add documentation for the new PyErr_SetFromImport* functions
1 parent 22a1d17 commit bd43974

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Doc/c-api/exceptions.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,24 @@ in various ways. There is a separate error indicator for each thread.
229229
Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional
230230
parameter specifying the exception type to be raised. Availability: Windows.
231231
232+
.. c:function:: PyObject* PyErr_SetExcWithArgsKwargs(PyObject *exc, PyObject *args, PyObject *kwargs)
233+
234+
This is a convenience function to set an *exc* with the given *args* and
235+
*kwargs* values. If *args* is ``NULL``, an empty :func:`tuple` will be
236+
created when *exc* is created via :c:func:`PyObject_Call`.
237+
238+
.. c:function:: PyObject* PyErr_SetFromImportErrorWithName(PyObject *msg, PyObject *name)
239+
240+
This is a convenience function to raise :exc:`ImportError`. *msg* will be
241+
set as the exception's message string, and *name* will be set as the
242+
:exc:`ImportError`'s ``name`` attribute.
243+
244+
.. c:function:: PyObject* PyErr_SetFromImportErrorWithNameAndPath(PyObject *msg, PyObject *name, PyObject *path)
245+
246+
This is a convenience function to raise :exc:`ImportError`. *msg* will be
247+
set as the exception's message string. Both *name* and *path* will be set
248+
as the :exc:`ImportError`'s respective ``name`` and ``path`` attributes.
249+
232250
233251
.. c:function:: void PyErr_SyntaxLocationEx(char *filename, int lineno, int col_offset)
234252

0 commit comments

Comments
 (0)