This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients amaury.forgeotdarc, brian.curtin, janglin, loewis, pitrou, schmir, vstinner
Date 2011-01-04.23:55:09
SpamBayes Score 4.9860677e-07
Marked as misclassified No
Message-id <1294185406.20722.2.camel@marge>
In-reply-to <4D23A1DC.7040508@v.loewis.de>
Content
> 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
overflow?).
History
Date User Action Args
2011-01-04 23:55:11vstinnersetrecipients: + vstinner, loewis, amaury.forgeotdarc, pitrou, schmir, brian.curtin, janglin
2011-01-04 23:55:09vstinnerlinkissue9566 messages
2011-01-04 23:55:09vstinnercreate