diff --git a/src/Mod/Part/App/GeometryPyImp.cpp b/src/Mod/Part/App/GeometryPyImp.cpp index c621036f8e..fe5755d2ed 100644 --- a/src/Mod/Part/App/GeometryPyImp.cpp +++ b/src/Mod/Part/App/GeometryPyImp.cpp @@ -248,7 +248,8 @@ PyObject* GeometryPy::getExtensionOfType(PyObject *args) std::shared_ptr ext(this->getGeometryPtr()->getExtension(type)); // we create a copy and transfer this copy's memory management responsibility to Python - PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(Py::new_reference_to(Py::Tuple(size_t(0)))); + Py::Tuple tuple; + PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(tuple.ptr()); return cpy; } @@ -282,7 +283,8 @@ PyObject* GeometryPy::getExtensionOfName(PyObject *args) std::shared_ptr ext(this->getGeometryPtr()->getExtension(std::string(o))); // we create a copy and transfer this copy's memory management responsibility to Python - PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(Py::new_reference_to(Py::Tuple(size_t(0)))); + Py::Tuple tuple; + PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(tuple.ptr()); return cpy; } @@ -408,8 +410,6 @@ PyObject* GeometryPy::getExtensions(PyObject *args) PyObject* list = PyList_New(ext.size()); - Py::Tuple tuple(ext.size()); - for (std::size_t i=0; i(p->getPyObject())->copy(Py::new_reference_to(Py::Tuple(size_t(0)))); + Py::Tuple tuple; + PyObject* cpy = static_cast(p->getPyObject())->copy(tuple.ptr()); PyList_SetItem( list, i, cpy); } diff --git a/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp b/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp index a8e122194f..306419244f 100644 --- a/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp +++ b/src/Mod/Sketcher/App/ExternalGeometryFacadePyImp.cpp @@ -270,7 +270,8 @@ PyObject* ExternalGeometryFacadePy::getExtensionOfType(PyObject *args) std::shared_ptr ext(this->getExternalGeometryFacadePtr()->getExtension(type)); // we create a copy and transfer this copy's memory management responsibility to Python - PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(Py::new_reference_to(Py::Tuple(size_t(0)))); + Py::Tuple tuple; + PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(tuple.ptr()); return cpy; } @@ -304,7 +305,8 @@ PyObject* ExternalGeometryFacadePy::getExtensionOfName(PyObject *args) std::shared_ptr ext(this->getExternalGeometryFacadePtr()->getExtension(std::string(o))); // we create a copy and transfer this copy's memory management responsibility to Python - PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(Py::new_reference_to(Py::Tuple(size_t(0)))); + Py::Tuple tuple; + PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(tuple.ptr()); return cpy; } @@ -430,15 +432,14 @@ PyObject* ExternalGeometryFacadePy::getExtensions(PyObject *args) PyObject* list = PyList_New(ext.size()); - Py::Tuple tuple(ext.size()); - for (std::size_t i=0; i p = ext[i].lock(); if(p) { // we create a python copy and add it to the list - PyObject* cpy = static_cast(std::const_pointer_cast(p)->getPyObject())->copy(Py::new_reference_to(Py::Tuple(size_t(0)))); + Py::Tuple tuple; + PyObject* cpy = static_cast(std::const_pointer_cast(p)->getPyObject())->copy(tuple.ptr()); PyList_SetItem( list, i, cpy); } diff --git a/src/Mod/Sketcher/App/GeometryFacadePyImp.cpp b/src/Mod/Sketcher/App/GeometryFacadePyImp.cpp index d6c3e06ab5..b89460a005 100644 --- a/src/Mod/Sketcher/App/GeometryFacadePyImp.cpp +++ b/src/Mod/Sketcher/App/GeometryFacadePyImp.cpp @@ -209,7 +209,8 @@ PyObject* GeometryFacadePy::getExtensionOfType(PyObject *args) std::shared_ptr ext(this->getGeometryFacadePtr()->getExtension(type)); // we create a copy and transfer this copy's memory management responsibility to Python - PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(Py::new_reference_to(Py::Tuple(size_t(0)))); + Py::Tuple tuple; + PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(tuple.ptr()); return cpy; } @@ -243,7 +244,8 @@ PyObject* GeometryFacadePy::getExtensionOfName(PyObject *args) std::shared_ptr ext(this->getGeometryFacadePtr()->getExtension(std::string(o))); // we create a copy and transfer this copy's memory management responsibility to Python - PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(Py::new_reference_to(Py::Tuple(size_t(0)))); + Py::Tuple tuple; + PyObject* cpy = static_cast(std::const_pointer_cast(ext)->getPyObject())->copy(tuple.ptr()); return cpy; } @@ -369,15 +371,14 @@ PyObject* GeometryFacadePy::getExtensions(PyObject *args) PyObject* list = PyList_New(ext.size()); - Py::Tuple tuple(ext.size()); - for (std::size_t i=0; i p = ext[i].lock(); if(p) { // we create a python copy and add it to the list - PyObject* cpy = static_cast(std::const_pointer_cast(p)->getPyObject())->copy(Py::new_reference_to(Py::Tuple(size_t(0)))); + Py::Tuple tuple; + PyObject* cpy = static_cast(std::const_pointer_cast(p)->getPyObject())->copy(tuple.ptr()); PyList_SetItem( list, i, cpy); }