[C++-sig] PyErr_ExceptionMatches not working?
Lawrence Spector
Lawrence.Spector at CanfieldSci.com
Wed Jul 18 21:10:53 CEST 2007
I have code that checks the following (snippet) when an exception is thrown...
if (PyErr_ExceptionMatches(PyExc_NameError))
{
// do something...
}
It doesn't get into that block, yet, when I do this:
PyErr_Fetch(&errObj, &errData, &errTraceback);
std::cout << "Object error" << PyString_AsString(PyObject_Str(errObj));
I get:
Object error: <type 'exceptions.NameError'>
What gives? Why isn't PyErr_ExceptionMatches saying that it's a NameError? Does Boost.Python provide a better way to do exception handling than the Python API directly?
Thanks,
Lawrence
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070718/4ed3d147/attachment.htm>
More information about the Cplusplus-sig
mailing list