[issue9566] Compilation warnings under x64 Windows

STINNER Victor report at bugs.python.org
Wed Jan 5 00:55:11 CET 2011

STINNER Victor <victor.stinner at haypocalc.com> added the comment:

> But the comment is actually wrong: It says
> len <= buf_size <= INT_MAX (see above)
> however, len > buf_size may happen, after this code:
>     if (len > buf_size) {
>         PyErr_Format(PyExc_ValueError,
>                      "read() returned too much data: "
>                      "%i bytes requested, %zd returned",
>                      buf_size, len);
>         goto finally;
>     }

Oh. Not only is the comment is wrong, but the code is also wrong. It
should return a negative value on error, whereas it returns the string
length which is always positive (except on a unlikely Py_ssize_t => int


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list