[New-bugs-announce] [issue19260] "int" comment in marshal.c is outdated

Larry Hastings report at bugs.python.org
Mon Oct 14 14:44:36 CEST 2013


New submission from Larry Hastings:

In r_string() (read a string) in marshal.c we see this comment:

    /* The result fits into int because it must be <=n. */
    read = fread(p->buf, 1, n, p->fp);

This comment was first committed in r36501 by MvL.  Back then the "read" and "n" variables were int, but (of course) the return size of fread was size_t.  Since then, both n and read have become ssize_t.

I suggest changing the wording slightly anyway, because I had to meditate on what the comment was originally trying to say.  I suggest:

    /* The result fits into ssize_t because n is ssize_t. */

Patch appended too.  Bikeshedding away!

Should this be fixed in previous versions too?

----------
files: larry.marshal.outdated.comment.r1.diff
keywords: patch
messages: 199883
nosy: larry
priority: normal
severity: normal
status: open
title: "int" comment in marshal.c is outdated
versions: Python 3.4
Added file: http://bugs.python.org/file32116/larry.marshal.outdated.comment.r1.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19260>
_______________________________________


More information about the New-bugs-announce mailing list