Problems with exception classes in C

Etienne Labuschagne etiennel at geospace.co.za
Tue Jul 18 09:33:59 EDT 2000


Hi there

I have written an extension module in C under Borland's C++ Builder 4.
Everything works fine except exceptions!

eg. the following compiles fine, but when it gets executed it causes and
access violation (which crashes the interpreter)

...
catch(...)    {
    PyErr_SetString(PyExc_TypeError, "An unknown error occurred.");
    return NULL;
    }

The above code is a catch-all to ensure that the interpreter is not crashed,
but the above code causes an access violation at the PyErr_SetString line
(if I step through in the debugger - running it normally just crashes the
Python interpreter).

Actually, all of the PyErr_Set... functions causes the same access
violation.  Am I doing something obviously wrong?  Must the PyExc_TypeError
object (or something else in the Python error handling) be initialised in
some way beforehand?

Any help would be greatly appreciated!

Regards
Etienne









More information about the Python-list mailing list