support to assign long to Quantity with Py2

This commit is contained in:
wmayer
2017-06-28 23:12:00 +02:00
parent ba5f618f93
commit e9975ee814

View File

@@ -94,10 +94,9 @@ Base::Quantity PropertyQuantity::createQuantityFromPy(PyObject *value)
#if PY_MAJOR_VERSION < 3
else if (PyInt_Check(value))
quant = Quantity((double)PyInt_AsLong(value),_Unit);
#else
#endif
else if (PyLong_Check(value))
quant = Quantity((double)PyLong_AsLong(value),_Unit);
#endif
else if (PyObject_TypeCheck(value, &(QuantityPy::Type))) {
Base::QuantityPy *pcObject = static_cast<Base::QuantityPy*>(value);
quant = *(pcObject->getQuantityPtr());