Base: Standardize on Py::Long type for Python bindings.

This commit is contained in:
tritao
2025-02-07 22:46:35 +00:00
parent 5117c82d33
commit 2145b742eb
44 changed files with 285 additions and 285 deletions

View File

@@ -212,7 +212,7 @@ PyObject* MatrixPy::number_power_handler(PyObject* self, PyObject* other, PyObje
Base::Matrix4D a = static_cast<MatrixPy*>(self)->value();
long b = Py::Int(other);
long b = Py::Long(other);
if (b == 0) {
return new MatrixPy(Matrix4D());
}
@@ -363,7 +363,7 @@ PyObject* MatrixPy::hasScale(PyObject* args)
ScaleType type = getMatrixPtr()->hasScale(tol);
Py::Module mod("FreeCAD");
return Py::new_reference_to(
mod.callMemberFunction("ScaleType", Py::TupleN(Py::Int(static_cast<int>(type)))));
mod.callMemberFunction("ScaleType", Py::TupleN(Py::Long(static_cast<int>(type)))));
}
PyObject* MatrixPy::decompose(PyObject* args)

View File

@@ -26,7 +26,7 @@ Class to dump and restore the content of an object.</UserDocu>
<Documentation>
<UserDocu>Memory size of the object in bytes.</UserDocu>
</Documentation>
<Parameter Name="MemSize" Type="Int"/>
<Parameter Name="MemSize" Type="Long"/>
</Attribute>
<Methode Name="dumpContent" Keyword="true" Const="true">
<Documentation>

View File

@@ -52,9 +52,9 @@ Py::String PersistencePy::getContent() const
return {writer.getString()};
}
Py::Int PersistencePy::getMemSize() const
Py::Long PersistencePy::getMemSize() const
{
return Py::Int((long)getPersistencePtr()->getMemSize());
return Py::Long((long)getPersistencePtr()->getMemSize());
}
PyObject* PersistencePy::dumpContent(PyObject* args, PyObject* kwds)

View File

@@ -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) {