diff --git a/src/Base/Exception.cpp b/src/Base/Exception.cpp index cdf61d248f..b8c535cd4d 100644 --- a/src/Base/Exception.cpp +++ b/src/Base/Exception.cpp @@ -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(Py::String(edict.getItem("sErrMsg"))); if (edict.hasKey("iline")) - _line = static_cast(Py::Long(edict.getItem("iline"))); +#if PY_MAJOR_VERSION >= 3 + _line = static_cast(Py::Long(edict.getItem("iline"))); +#else + _line = static_cast(Py::Int(edict.getItem("iline"))); +#endif } }