+ fixes #0001816: parseQuantity returns garbage
This commit is contained in:
parent
d66fc092e1
commit
5c84e47422
|
@ -131,12 +131,12 @@ PyObject* UnitsApi::sParseQuantity(PyObject * /*self*/, PyObject *args,PyObject
|
|||
if (!PyArg_ParseTuple(args, "et", "utf-8", &pstr)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
Quantity rtn;
|
||||
QString qstr = QString::fromUtf8(pstr);
|
||||
PyMem_Free(pstr);
|
||||
Quantity rtn;
|
||||
QString qstr = QString::fromUtf8(pstr);
|
||||
PyMem_Free(pstr);
|
||||
try {
|
||||
rtn = Quantity::parse(QString::fromLatin1(pstr));
|
||||
}
|
||||
rtn = Quantity::parse(qstr);
|
||||
}
|
||||
catch (const Base::Exception&) {
|
||||
PyErr_Format(PyExc_IOError, "invalid unit expression \n");
|
||||
return 0L;
|
||||
|
@ -146,6 +146,5 @@ PyObject* UnitsApi::sParseQuantity(PyObject * /*self*/, PyObject *args,PyObject
|
|||
return 0L;
|
||||
}
|
||||
|
||||
return new QuantityPy(new Quantity(rtn));
|
||||
|
||||
return new QuantityPy(new Quantity(rtn));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user