Exception Handling (C - extending python)

Lee lchaplin13 at gmail.com
Sun Oct 23 07:32:00 EDT 2011


Thanks Stefan,

I am just interested to understand the mechanism inside python.

If it points to an object that means I can defered it (through
ob_type).
>From there, how a function like PyErr_SetString knows what exception
is?
Where its value is kept?

Lee


On Oct 23, 10:06 pm, Stefan Behnel <stefan... at behnel.de> wrote:
> Lee, 23.10.2011 06:09:
>
> > 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 gets initialised inside of the interpreter core and then points to a
> Python object.
>
> > Any help is greatly appreciated.
>
> The question is: why do you ask? What exactly do you want to do?
>
> If you ask a more targeted question, you will get an answer that will help
> you further.
>
> Stefan




More information about the Python-list mailing list