C-wrapper includes file and lineno when unknown exceptino is encountered

This commit is contained in:
Siu Kwan Lam 2013-01-17 16:44:01 -06:00
commit 343efc6379

View file

@ -60,6 +60,7 @@
#include "llvm_c_extra.h"
#include <new>
#include <sstream>
class py_exception: public std::exception{};
@ -75,9 +76,10 @@ class py_exception: public std::exception{};
PyErr_SetString(PyExc_RuntimeError, e.what()); \
return NULL; \
} catch (...) { \
PyErr_SetString(PyExc_RuntimeError, \
"Unknown exception"); \
return NULL; \
std::ostringstream oss; \
oss << "Unknown exception " << __FILE__ << ":" << __LINE__; \
PyErr_SetString(PyExc_RuntimeError, oss.str().c_str()); \
return NULL; \
}
/*===----------------------------------------------------------------------===*/