(original) (raw)

changeset: 76363:5cc8b717b38c user: Brian Curtin brian@python.org date: Mon Apr 16 15:14:36 2012 -0500 files: Doc/c-api/exceptions.rst description: Add documentation for the new PyErr_SetFromImport* functions diff -r 9d8839289e18 -r 5cc8b717b38c Doc/c-api/exceptions.rst --- a/Doc/c-api/exceptions.rst Mon Apr 16 22:06:21 2012 +0200 +++ b/Doc/c-api/exceptions.rst Mon Apr 16 15:14:36 2012 -0500 @@ -229,6 +229,24 @@ Similar to :c:func:`PyErr_SetFromWindowsErrWithFilename`, with an additional parameter specifying the exception type to be raised. Availability: Windows. +.. c:function:: PyObject* PyErr_SetExcWithArgsKwargs(PyObject *exc, PyObject *args, PyObject *kwargs) + + This is a convenience function to set an *exc* with the given *args* and + *kwargs* values. If *args* is ``NULL``, an empty :func:`tuple` will be + created when *exc* is created via :c:func:`PyObject_Call`. + +.. c:function:: PyObject* PyErr_SetFromImportErrorWithName(PyObject *msg, PyObject *name) + + This is a convenience function to raise :exc:`ImportError`. *msg* will be + set as the exception's message string, and *name* will be set as the + :exc:`ImportError`'s ``name`` attribute. + +.. c:function:: PyObject* PyErr_SetFromImportErrorWithNameAndPath(PyObject *msg, PyObject *name, PyObject *path) + + This is a convenience function to raise :exc:`ImportError`. *msg* will be + set as the exception's message string. Both *name* and *path* will be set + as the :exc:`ImportError`'s respective ``name`` and ``path`` attributes. + .. c:function:: void PyErr_SyntaxLocationEx(char *filename, int lineno, int col_offset) /brian@python.org