You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
False positive in a function marked raising on negative result #158
RAISES_NEGstaticinttest_cpychecker(PyObject*pyval)
{
intrv=-1;
longval;
if (PyInt_Check(pyval)) {
val=PyInt_AsLong(pyval);
if (val==-1&&PyErr_Occurred()) { goto exit; }
if (val<1||val>4) {
PyErr_SetString(PyExc_ValueError,
"isolation_level must be between 1 and 4");
goto exit;
}
rv=val;
/* Work around cpychecker false positive *//* if (rv < 0) { *//* PyErr_SetString(PyExc_ValueError, *//* "isolation_level must be between 1 and 4"); *//* goto exit; *//* } */
}
else {
rv=1;
}
exit:
returnrv;
}
where the case that 1 <= val <= 4 is not transferred to rv, so it seems a negative number can be returned with no exception, resulting in the following trace.
Enabling the commented block removes the false positive. I tried to add a test to the plugin test suite but no success.
Activity
[-]False positive in a function marked[/-][+]False positive in a function marked raising on negative result[/+]Work around false cpychecker false positive
Work around false cpychecker false positive
Work around false cpychecker false positive
Work around false cpychecker false positive
Work around false cpychecker false positive
Work around false cpychecker false positive
Work around false cpychecker false positive