python: use const_cast<> to new() python types.
This commit is contained in:
@@ -101,7 +101,7 @@ PyObject* BSplineCurvePy::__reduce__(PyObject *args) const
|
||||
tuple.setItem(0, type);
|
||||
|
||||
// create an argument tuple to create a copy
|
||||
Py::Object self(this);
|
||||
Py::Object self(const_cast<BSplineCurvePy*>(this));
|
||||
Py::Tuple data(7);
|
||||
data.setItem(0, Py::Callable(self.getAttr("getPoles")).apply());
|
||||
data.setItem(1, Py::Callable(self.getAttr("getMultiplicities")).apply());
|
||||
|
||||
@@ -161,7 +161,7 @@ PyObject* Geometry2dPy::copy(PyObject *args) const
|
||||
PyObject* cpy = nullptr;
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<Geometry2dPy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_TypeError, "failed to create copy of geometry");
|
||||
return nullptr;
|
||||
|
||||
@@ -59,7 +59,7 @@ PyObject* GeometryExtensionPy::copy(PyObject *args) const
|
||||
PyObject* cpy = nullptr;
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<GeometryExtensionPy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_TypeError, "failed to create copy of the geometry extension");
|
||||
return nullptr;
|
||||
|
||||
@@ -159,7 +159,7 @@ PyObject* GeometryPy::copy(PyObject *args) const
|
||||
PyObject* cpy = nullptr;
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<GeometryPy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_TypeError, "failed to create copy of geometry");
|
||||
return nullptr;
|
||||
@@ -186,7 +186,7 @@ PyObject* GeometryPy::clone(PyObject *args) const
|
||||
PyObject* cpy = nullptr;
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<GeometryPy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_TypeError, "failed to create clone of geometry");
|
||||
return nullptr;
|
||||
|
||||
@@ -863,7 +863,7 @@ PyObject* GeometrySurfacePy::intersect(PyObject *args) const
|
||||
GeometryCurvePy* curve = static_cast<GeometryCurvePy*>(p);
|
||||
PyObject* t = PyTuple_New(2);
|
||||
Py_INCREF(this);
|
||||
PyTuple_SetItem(t, 0, this);
|
||||
PyTuple_SetItem(t, 0, const_cast<GeometrySurfacePy*>(this));
|
||||
PyTuple_SetItem(t, 1, PyFloat_FromDouble(prec));
|
||||
return curve->intersectCS(t);
|
||||
} else {
|
||||
|
||||
@@ -1362,7 +1362,7 @@ PyObject* TopoShapePy::reversed(PyObject *args) const
|
||||
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<TopoShapePy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_TypeError, "failed to create copy of shape");
|
||||
return nullptr;
|
||||
@@ -2342,7 +2342,7 @@ PyObject* TopoShapePy::defeaturing(PyObject *args) const
|
||||
);
|
||||
}
|
||||
PyTypeObject* type = this->GetType();
|
||||
PyObject* inst = type->tp_new(type, this, nullptr);
|
||||
PyObject* inst = type->tp_new(type, const_cast<TopoShapePy*>(this), nullptr);
|
||||
static_cast<TopoShapePy*>(inst)->getTopoShapePtr()->setShape
|
||||
(this->getTopoShapePtr()->defeaturing(shapes));
|
||||
return inst;
|
||||
|
||||
@@ -63,7 +63,7 @@ PyObject* CenterLinePy::clone(PyObject *args) const
|
||||
PyObject* cpy = nullptr;
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<CenterLinePy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "failed to create clone of CenterLine");
|
||||
return nullptr;
|
||||
@@ -90,7 +90,7 @@ PyObject* CenterLinePy::copy(PyObject *args) const
|
||||
PyObject* cpy = nullptr;
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<CenterLinePy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "failed to create copy of CenterLine");
|
||||
return nullptr;
|
||||
|
||||
@@ -67,7 +67,7 @@ PyObject* CosmeticVertexPy::clone(PyObject *args) const
|
||||
PyObject* cpy = nullptr;
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<CosmeticVertexPy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_TypeError, "failed to create clone of CosmeticVertex");
|
||||
return nullptr;
|
||||
@@ -95,7 +95,7 @@ PyObject* CosmeticVertexPy::copy(PyObject *args) const
|
||||
PyObject* cpy = nullptr;
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<CosmeticVertexPy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_TypeError, "failed to create copy of CosmeticVertex");
|
||||
return nullptr;
|
||||
|
||||
@@ -58,7 +58,7 @@ PyObject* GeomFormatPy::clone(PyObject *args) const
|
||||
PyObject* cpy = nullptr;
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<GeomFormatPy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "failed to create clone of GeomFormat");
|
||||
return nullptr;
|
||||
@@ -85,7 +85,7 @@ PyObject* GeomFormatPy::copy(PyObject *args) const
|
||||
PyObject* cpy = nullptr;
|
||||
// let the type object decide
|
||||
if (type->tp_new)
|
||||
cpy = type->tp_new(type, this, nullptr);
|
||||
cpy = type->tp_new(type, const_cast<GeomFormatPy*>(this), nullptr);
|
||||
if (!cpy) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "failed to create copy of GeomFormat");
|
||||
return nullptr;
|
||||
|
||||
Reference in New Issue
Block a user