Py: [skip ci] replace PyList_Append with Py::List::append
This commit is contained in:
@@ -412,7 +412,7 @@ PyObject* GeometryPy::getExtensions(PyObject *args)
|
||||
try {
|
||||
const std::vector<std::weak_ptr<const GeometryExtension>> ext = this->getGeometryPtr()->getExtensions();
|
||||
|
||||
PyObject* list = PyList_New(0);
|
||||
Py::List list;
|
||||
|
||||
for (std::size_t i=0; i<ext.size(); ++i) {
|
||||
|
||||
@@ -423,9 +423,7 @@ PyObject* GeometryPy::getExtensions(PyObject *args)
|
||||
// we create a python copy and add it to the list
|
||||
|
||||
try {
|
||||
PyObject* cpy = p->copyPyObject();
|
||||
PyList_Append( list, cpy);
|
||||
Py_DECREF(cpy);
|
||||
list.append(Py::asObject(p->copyPyObject()));
|
||||
}
|
||||
catch(Base::NotImplementedError) {
|
||||
// silently ignoring extensions not having a Python object
|
||||
@@ -433,7 +431,7 @@ PyObject* GeometryPy::getExtensions(PyObject *args)
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
catch(const Base::ValueError& e) {
|
||||
PyErr_SetString(PartExceptionOCCError, e.what());
|
||||
|
||||
Reference in New Issue
Block a user