Base: Do not use else before return

This commit is contained in:
Ladislav Michl
2023-11-15 10:12:42 +01:00
committed by 3x380V
parent 915bfd3dde
commit 95b37fa806
13 changed files with 115 additions and 176 deletions

View File

@@ -508,20 +508,18 @@ PyObject* QuantityPy::number_power_handler(PyObject* self, PyObject* other, PyOb
return new QuantityPy(new Quantity(q));
}
else if (PyFloat_Check(other)) {
if (PyFloat_Check(other)) {
Base::Quantity* a = static_cast<QuantityPy*>(self)->getQuantityPtr();
double b = PyFloat_AsDouble(other);
return new QuantityPy(new Quantity(a->pow(b)));
}
else if (PyLong_Check(other)) {
if (PyLong_Check(other)) {
Base::Quantity* a = static_cast<QuantityPy*>(self)->getQuantityPtr();
double b = (double)PyLong_AsLong(other);
return new QuantityPy(new Quantity(a->pow(b)));
}
else {
PyErr_SetString(PyExc_TypeError, "Expected quantity or number");
return nullptr;
}
PyErr_SetString(PyExc_TypeError, "Expected quantity or number");
return nullptr;
}
PY_CATCH
}