diff -r dabe2486e2ce Modules/_io/fileio.c --- a/Modules/_io/fileio.c Wed Oct 31 00:37:41 2012 +0100 +++ b/Modules/_io/fileio.c Wed Oct 31 00:43:12 2012 +0100 @@ -602,7 +602,7 @@ fileio_readall(fileio *self) #endif PyObject *result; Py_ssize_t total = 0; - int n; + Py_ssize_t n; size_t newsize; if (self->fd < 0) @@ -651,9 +651,18 @@ fileio_readall(fileio *self) } Py_BEGIN_ALLOW_THREADS errno = 0; + n = newsize - total; +#if defined(MS_WIN64) || defined(MS_WINDOWS) + if (n > INT_MAX) + n = INT_MAX; n = read(self->fd, PyBytes_AS_STRING(result) + total, - newsize - total); + (int)n); +#else + n = read(self->fd, + PyBytes_AS_STRING(result) + total, + n); +#endif Py_END_ALLOW_THREADS if (n == 0) break;