Navigation Menu

Skip to content

Commit

Permalink
App: fix Python object leak in ObjectIdentifier
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder authored and wwmayer committed Aug 30, 2019
1 parent 88a1a94 commit 04d6785
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/App/ObjectIdentifier.cpp
Expand Up @@ -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();
Expand All @@ -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();
}
Expand All @@ -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();
}
Expand Down

0 comments on commit 04d6785

Please sign in to comment.