fix build failure and make Py2/Py3 specific change
This commit is contained in:
@@ -109,7 +109,11 @@ PyObject * Exception::getPyObject(void)
|
||||
edict.setItem("sclassname", Py::String(typeid(*this).name()));
|
||||
edict.setItem("sErrMsg", Py::String(this->getMessage()));
|
||||
edict.setItem("sfile", Py::String(this->getFile()));
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
edict.setItem("iline", Py::Long(this->getLine()));
|
||||
#else
|
||||
edict.setItem("iline", Py::Int(this->getLine()));
|
||||
#endif
|
||||
edict.setItem("sfunction", Py::String(this->getFunction()));
|
||||
edict.setItem("swhat", Py::String(this->what()));
|
||||
return Py::new_reference_to(edict);
|
||||
@@ -129,7 +133,11 @@ void Exception::setPyObject( PyObject * pydict)
|
||||
_sErrMsg = static_cast<std::string>(Py::String(edict.getItem("sErrMsg")));
|
||||
|
||||
if (edict.hasKey("iline"))
|
||||
_line = static_cast<int>(Py::Long(edict.getItem("iline")));
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
_line = static_cast<long>(Py::Long(edict.getItem("iline")));
|
||||
#else
|
||||
_line = static_cast<int>(Py::Int(edict.getItem("iline")));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user