Message125384
| 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?). |
|