python: use const_cast<> to new() python types.

This commit is contained in:
Jacob Oursland
2025-04-16 20:31:15 -07:00
parent 5b81cd741a
commit bd9907a06d
9 changed files with 14 additions and 14 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;