Exception Handling (C - extending python)

Christian Heimes lists at cheimes.de
Sun Oct 23 08:12:18 EDT 2011


Am 23.10.2011 06:09, schrieb Lee:
> Hi all,
> 
> Where does PyExc_TypeError (and alike) points to? I can see its
> declaration - PyAPI_DATA(PyObject *) PyExc_TypeError; - in pyerrors.h
> but I cannot figure out what it is its value, where it is
> initialized.

It's initialized in Objects/exceptions.c

SimpleExtendsException(PyExc_StandardError, TypeError,
                       "Inappropriate argument type.");

SimpleExtendsException() is a macro that defines a PyTypeObject and
stores a cast to PyObject in PyExc_TypeError.

Christian




More information about the Python-list mailing list