cpython: e8646f120330 (original) (raw)

Mercurial > cpython

changeset 71225:e8646f120330

(merge 3.2) Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows. [#9611]

Victor Stinner victor.stinner@haypocalc.com
date Tue, 05 Jul 2011 11:34:18 +0200
parents e38bb637328c(current diff)7acdf9f5eb31(diff)
children 42e23db3ddfc
files Misc/NEWS Modules/_io/fileio.c
diffstat 2 files changed, 11 insertions(+), 1 deletions(-)[+] [-] Misc/NEWS 4 Modules/_io/fileio.c 8

line wrap: on

line diff

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ What's New in Python 3.3 Alpha 1? Core and Builtins ----------------- +- Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows. +

--- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -687,6 +687,10 @@ fileio_read(fileio *self, PyObject *args return fileio_readall(self); } +#if defined(MS_WIN64) || defined(MS_WINDOWS)

+#endif bytes = PyBytes_FromStringAndSize(NULL, size); if (bytes == NULL) return NULL; @@ -695,7 +699,11 @@ fileio_read(fileio *self, PyObject *args if (_PyVerify_fd(self->fd)) { Py_BEGIN_ALLOW_THREADS errno = 0; +#if defined(MS_WIN64) || defined(MS_WINDOWS)

+#else n = read(self->fd, ptr, size); +#endif Py_END_ALLOW_THREADS } else n = -1;