Name
PyErr_Format
Synopsis
PyObject* PyErr_Format(PyObject*type
,char*format
,...)
Raises an exception of class
type
, a built-in such as
PyExc_IndexError
, or an exception class created
with PyErr_NewException
. Builds the associated
value from format string format
, which has
syntax similar to printf
’s, and
the following C values indicated as variable arguments above. Returns
NULL
, so your code can just call:
return PyErr_Format(PyExc_KeyError, "Unknown key name (%s)", thekeystring);
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.