App: fix Python object leak in ObjectIdentifier
This commit is contained in:
@@ -614,7 +614,7 @@ Py::Object ObjectIdentifier::Component::get(const Py::Object &pyobj) const {
|
||||
assert(isRange());
|
||||
Py::Object slice(PySlice_New(Py::Int(begin).ptr(),
|
||||
end!=INT_MAX?Py::Int(end).ptr():0,
|
||||
step!=1?Py::Int(step).ptr():0));
|
||||
step!=1?Py::Int(step).ptr():0),true);
|
||||
PyObject *r = PyObject_GetItem(pyobj.ptr(),slice.ptr());
|
||||
if(!r)
|
||||
Base::PyException::ThrowException();
|
||||
@@ -640,7 +640,7 @@ void ObjectIdentifier::Component::set(Py::Object &pyobj, const Py::Object &value
|
||||
assert(isRange());
|
||||
Py::Object slice(PySlice_New(Py::Int(begin).ptr(),
|
||||
end!=INT_MAX?Py::Int(end).ptr():0,
|
||||
step!=1?Py::Int(step).ptr():0));
|
||||
step!=1?Py::Int(step).ptr():0),true);
|
||||
if(PyObject_SetItem(pyobj.ptr(),slice.ptr(),value.ptr())<0)
|
||||
Base::PyException::ThrowException();
|
||||
}
|
||||
@@ -660,7 +660,7 @@ void ObjectIdentifier::Component::del(Py::Object &pyobj) const {
|
||||
assert(isRange());
|
||||
Py::Object slice(PySlice_New(Py::Int(begin).ptr(),
|
||||
end!=INT_MAX?Py::Int(end).ptr():0,
|
||||
step!=1?Py::Int(step).ptr():0));
|
||||
step!=1?Py::Int(step).ptr():0),true);
|
||||
if(PyObject_DelItem(pyobj.ptr(),slice.ptr())<0)
|
||||
Base::PyException::ThrowException();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user