New submission from lekma <lekma...@gmail.com>:

It would be nice to have an obvious/simple way to document C exceptions
(especially when using the autoexception feature from Sphinx).

Something along:

PyObject *PyErr_Create(char *name, const char *doc)
    Creates and returns a new exception object.
    This behaves like PyErr_Create2() with base set to NULL.

PyObject *PyErr_Create2(char *name, const char *doc, PyObject *base)
    Creates and returns a new exception object.
    The name argument must be the name of the new exception, a C string
of the form module.class.
    If doc is non-NULL, it will be used to define the docstring for the
exception.
    if base is NULL, it creates a class object derived from Exception
(accessible in C as PyExc_Exception).

for py3k the signatures would be:
PyObject *PyErr_Create(const char *name, const char *doc)
PyObject *PyErr_Create2(const char *name, const char *doc, PyObject *base)

Internally, these functions would pass a dict to PyErr_NewException with
the key '__doc__' set to doc.

If there is support for this, I can provide patches for trunk and py3k.

----------
components: Interpreter Core
messages: 93439
nosy: lekma
severity: normal
status: open
title: C/API - Document exceptions
type: feature request
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7033>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to