mirror of
https://github.com/nasa/trick.git
synced 2025-02-20 09:16:20 +00:00
Use udunits package for units conversions
PyFrame_GetLineNumber is not present in python 2.6. We have to use PyCode_Addr2Line instead to get the line number. refs #231
This commit is contained in:
parent
929372e863
commit
384519ce24
@ -33,7 +33,11 @@ PyObject * attach_units(PyObject * in_units_obj , PyObject * in_object) {
|
||||
int line_no = 0 ;
|
||||
if (NULL != tstate && NULL != tstate->frame) {
|
||||
file_name = PyString_AsString(tstate->frame->f_code->co_filename);
|
||||
#if (PY_MAJOR_VERSION == 2 ) && (PY_MINOR_VERSION <= 6)
|
||||
line_no = PyCode_Addr2Line(tstate->frame->f_code, tstate->frame->f_lasti) ;
|
||||
#else
|
||||
line_no = PyFrame_GetLineNumber(tstate->frame) ;
|
||||
#endif
|
||||
}
|
||||
std::cout << "\033[33mUnits converted from [" << in_units << "] to [" << new_units << "] "
|
||||
<< file_name << ":" << line_no << "\033[0m" << std::endl ;
|
||||
|
Loading…
x
Reference in New Issue
Block a user