Christian Heimes added the comment:

Coverity is concerned about the value of `q` when `len < 0`. The expression

   Py_ssize_t q = len > 0 ? 1 + (len - 1) / inrate : 0;

returns a positive, non-null value for len > 0. Another check ensures that len 
!= 0 a couple of lines earlier. In theory it is possible that len < 0. After 
all it's a signed integer type.

Coverity tries very hard to guess the intention of code. Because there is a 
check for len > 0, Coverity thinks that the code has to handle len < 0. IMO a 
good fix should check len >= 0 very early and replace that line with

   Py_ssize_t q = 1 + (len - 1) / inrate;

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20394>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to