PVS: V646 Consider inspecting the application's logic. It's possible that 'else' keyword is missing.

This commit is contained in:
wmayer
2020-07-17 22:59:21 +02:00
parent 4bbdfb5f7b
commit 70c3cc7c03

View File

@@ -830,18 +830,21 @@ void Expression::Component::set(const Expression *owner, Py::Object &pyobj, cons
void Expression::Component::del(const Expression *owner, Py::Object &pyobj) const {
try {
if(!e1 && !e2 && !e3) {
if (!e1 && !e2 && !e3) {
comp.del(pyobj);
} if(!comp.isRange() && !e2 && !e3) {
}
else if (!comp.isRange() && !e2 && !e3) {
auto index = e1->getPyValue();
if(pyobj.isMapping())
if (pyobj.isMapping()) {
Py::Mapping(pyobj).delItem(index);
}
else {
Py_ssize_t i = PyNumber_AsSsize_t(pyobj.ptr(), PyExc_IndexError);
if(PyErr_Occurred() || PySequence_DelItem(pyobj.ptr(),i)==-1)
if (PyErr_Occurred() || PySequence_DelItem(pyobj.ptr(),i)==-1)
throw Py::Exception();
}
}else{
}
else {
Py::Object v1,v2,v3;
if(e1) v1 = e1->getPyValue();
if(e2) v2 = e2->getPyValue();
@@ -849,13 +852,14 @@ void Expression::Component::del(const Expression *owner, Py::Object &pyobj) cons
PyObject *s = PySlice_New(e1?v1.ptr():nullptr,
e2?v2.ptr():nullptr,
e3?v3.ptr():nullptr);
if(!s)
if (!s)
throw Py::Exception();
Py::Object slice(s,true);
if(PyObject_DelItem(pyobj.ptr(),slice.ptr())<0)
if (PyObject_DelItem(pyobj.ptr(),slice.ptr())<0)
throw Py::Exception();
}
}catch(Py::Exception &) {
}
catch(Py::Exception &) {
EXPR_PY_THROW(owner);
}
}