MCPcopy Create free account
hub / github.com/SamuraiT/mecab-python3 / SWIG_Python_AddErrorMsg

Function SWIG_Python_AddErrorMsg

src/MeCab/MeCab_wrap.cpp:909–933  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

907
908
909SWIGRUNTIME void
910SWIG_Python_AddErrorMsg(const char* mesg)
911{
912 PyObject *type = 0;
913 PyObject *value = 0;
914 PyObject *traceback = 0;
915
916 if (PyErr_Occurred())
917 PyErr_Fetch(&type, &value, &traceback);
918 if (value) {
919 PyObject *old_str = PyObject_Str(value);
920 const char *tmp = SWIG_Python_str_AsChar(old_str);
921 PyErr_Clear();
922 Py_XINCREF(type);
923 if (tmp)
924 PyErr_Format(type, "%s %s", tmp, mesg);
925 else
926 PyErr_Format(type, "%s", mesg);
927 SWIG_Python_str_DelForPy3(tmp);
928 Py_DECREF(old_str);
929 Py_DECREF(value);
930 } else {
931 PyErr_SetString(PyExc_RuntimeError, mesg);
932 }
933}
934
935SWIGRUNTIME int
936SWIG_Python_TypeErrorOccurred(PyObject *obj)

Callers

nothing calls this directly

Calls 1

SWIG_Python_str_AsCharFunction · 0.85

Tested by

no test coverage detected