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 Matt.Mackall, benjamin.peterson, brett.cannon, eric.smith, ezio.melotti, josh.r, larry, loewis, ncoghlan, pitrou, vstinner
Date 2014-04-16.05:53:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1397627631.07.0.606788436671.issue21199@psf.upfronthosting.co.za>
In-reply-to
Content
On Windows, the type of the size parameter of read() is an unsigned int, not long nor size_t:
http://msdn.microsoft.com/en-us/library/1570wh78.aspx

FileIO.read() of Python 3 uses a size_t type but also:

#ifdef MS_WINDOWS
    if (size > INT_MAX)
        size = INT_MAX;
#endif
...
#ifdef MS_WINDOWS
        n = read(self->fd, ptr, (int)size);
#else
        n = read(self->fd, ptr, size);
#endif


Using a size_t to parse the Python parameter would avoid an OverflowError and the function would be more portable. But it would not permit to read more than 2 GB at once.
History
Date User Action Args
2014-04-16 05:53:51vstinnersetrecipients: + vstinner, loewis, brett.cannon, ncoghlan, pitrou, larry, eric.smith, benjamin.peterson, ezio.melotti, Matt.Mackall, josh.r
2014-04-16 05:53:51vstinnersetmessageid: <1397627631.07.0.606788436671.issue21199@psf.upfronthosting.co.za>
2014-04-16 05:53:51vstinnerlinkissue21199 messages
2014-04-16 05:53:50vstinnercreate