Base: Standardize on Py::Long type for Python bindings.
This commit is contained in:
@@ -641,9 +641,9 @@ Py::Dict QuantityPy::getFormat() const
|
||||
QuantityFormat fmt = getQuantityPtr()->getFormat();
|
||||
|
||||
Py::Dict dict;
|
||||
dict.setItem("Precision", Py::Int(fmt.precision));
|
||||
dict.setItem("Precision", Py::Long(fmt.precision));
|
||||
dict.setItem("NumberFormat", Py::Char(fmt.toFormat()));
|
||||
dict.setItem("Denominator", Py::Int(fmt.denominator));
|
||||
dict.setItem("Denominator", Py::Long(fmt.denominator));
|
||||
return dict;
|
||||
}
|
||||
|
||||
@@ -652,14 +652,14 @@ void QuantityPy::setFormat(Py::Dict arg)
|
||||
QuantityFormat fmt = getQuantityPtr()->getFormat();
|
||||
|
||||
if (arg.hasKey("Precision")) {
|
||||
Py::Int prec(arg.getItem("Precision"));
|
||||
Py::Long prec(arg.getItem("Precision"));
|
||||
fmt.precision = static_cast<int>(prec);
|
||||
}
|
||||
|
||||
if (arg.hasKey("NumberFormat")) {
|
||||
Py::Object item = arg.getItem("NumberFormat");
|
||||
if (item.isNumeric()) {
|
||||
int format = static_cast<int>(Py::Int(item));
|
||||
int format = static_cast<int>(Py::Long(item));
|
||||
if (format < 0 || format > QuantityFormat::Scientific) {
|
||||
throw Py::ValueError("Invalid format value");
|
||||
}
|
||||
@@ -681,7 +681,7 @@ void QuantityPy::setFormat(Py::Dict arg)
|
||||
}
|
||||
|
||||
if (arg.hasKey("Denominator")) {
|
||||
Py::Int denom(arg.getItem("Denominator"));
|
||||
Py::Long denom(arg.getItem("Denominator"));
|
||||
int fracInch = static_cast<int>(denom);
|
||||
// check that the value is positive and a power of 2
|
||||
if (fracInch <= 0) {
|
||||
|
||||
Reference in New Issue
Block a user