mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 09:25:45 +08:00
Merge pull request #23638 from soyszala:issue#23633
Proposed solution for issue #23633
This commit is contained in:
commit
435ccfdd51
@ -54,12 +54,24 @@ PyObject* failmsgp(const char *fmt, ...)
|
||||
|
||||
void pyRaiseCVException(const cv::Exception &e)
|
||||
{
|
||||
PyObject_SetAttrString(opencv_error, "file", PyString_FromString(e.file.c_str()));
|
||||
PyObject_SetAttrString(opencv_error, "func", PyString_FromString(e.func.c_str()));
|
||||
PyObject_SetAttrString(opencv_error, "line", PyInt_FromLong(e.line));
|
||||
PyObject_SetAttrString(opencv_error, "code", PyInt_FromLong(e.code));
|
||||
PyObject_SetAttrString(opencv_error, "msg", PyString_FromString(e.msg.c_str()));
|
||||
PyObject_SetAttrString(opencv_error, "err", PyString_FromString(e.err.c_str()));
|
||||
PyObject* temp_obj = PyString_FromString(e.file.c_str());
|
||||
PyObject_SetAttrString(opencv_error, "file", temp_obj);
|
||||
Py_DECREF(temp_obj);
|
||||
temp_obj = PyString_FromString(e.func.c_str());
|
||||
PyObject_SetAttrString(opencv_error, "func", temp_obj);
|
||||
Py_DECREF(temp_obj);
|
||||
temp_obj = PyInt_FromLong(e.line);
|
||||
PyObject_SetAttrString(opencv_error, "line", temp_obj);
|
||||
Py_DECREF(temp_obj);
|
||||
temp_obj = PyInt_FromLong(e.code);
|
||||
PyObject_SetAttrString(opencv_error, "code", temp_obj);
|
||||
Py_DECREF(temp_obj);
|
||||
temp_obj = PyString_FromString(e.msg.c_str());
|
||||
PyObject_SetAttrString(opencv_error, "msg", temp_obj);
|
||||
Py_DECREF(temp_obj);
|
||||
temp_obj = PyString_FromString(e.err.c_str());
|
||||
PyObject_SetAttrString(opencv_error, "err", temp_obj);
|
||||
Py_DECREF(temp_obj);
|
||||
PyErr_SetString(opencv_error, e.what());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user