#7033: add new API function PyErr_NewExceptionWithDoc, for easily giving new exceptions a docstring.

This commit is contained in:
Georg Brandl 2009-12-28 08:34:58 +00:00
parent 02e7dfde63
commit 740cdc3a9f
7 changed files with 119 additions and 2 deletions

View file

@ -433,6 +433,15 @@ is a separate error indicator for each thread.
argument can be used to specify a dictionary of class variables and methods.
.. cfunction:: PyObject* PyErr_NewExceptionWithDoc(char *name, char *doc, PyObject *base, PyObject *dict)
Same as :cfunc:`PyErr_NewException`, except that the new exception class can
easily be given a docstring: If *doc* is non-*NULL*, it will be used as the
docstring for the exception class.
.. versionadded:: 2.7
.. cfunction:: void PyErr_WriteUnraisable(PyObject *obj)
This utility function prints a warning message to ``sys.stderr`` when an

View file

@ -242,6 +242,12 @@ PyErr_NewException:char*:name::
PyErr_NewException:PyObject*:base:0:
PyErr_NewException:PyObject*:dict:0:
PyErr_NewExceptionWithDoc:PyObject*::+1:
PyErr_NewExceptionWithDoc:char*:name::
PyErr_NewExceptionWithDoc:char*:doc::
PyErr_NewExceptionWithDoc:PyObject*:base:0:
PyErr_NewExceptionWithDoc:PyObject*:dict:0:
PyErr_NoMemory:PyObject*::null:
PyErr_NormalizeException:void:::