File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ What's New in Python 3.3 Alpha 1?
1010Core and Builtins
1111-----------------
1212
13+ - Issue #9611, #9015: FileIO.read() clamps the length to INT_MAX on Windows.
14+
1315- Issue #9642: Uniformize the tests on the availability of the mbcs codec, add
1416 a new HAVE_MBCS define.
1517
@@ -1327,7 +1329,7 @@ Core and Builtins
13271329 (length bigger than 2^31-1 bytes).
13281330
13291331- Issue #9015, #9611: FileIO.readinto(), FileIO.write(), os.write() and
1330- stdprinter.write() clamp the length to 2^31-1 on Windows.
1332+ stdprinter.write() clamp the length to INT_MAX on Windows.
13311333
13321334- Issue #8278: On Windows and with a NTFS filesystem, os.stat() and os.utime()
13331335 can now handle dates after 2038.
Original file line number Diff line number Diff line change @@ -687,6 +687,10 @@ fileio_read(fileio *self, PyObject *args)
687687 return fileio_readall (self );
688688 }
689689
690+ #if defined(MS_WIN64 ) || defined(MS_WINDOWS )
691+ if (size > INT_MAX )
692+ size = INT_MAX ;
693+ #endif
690694 bytes = PyBytes_FromStringAndSize (NULL , size );
691695 if (bytes == NULL )
692696 return NULL ;
@@ -695,7 +699,11 @@ fileio_read(fileio *self, PyObject *args)
695699 if (_PyVerify_fd (self -> fd )) {
696700 Py_BEGIN_ALLOW_THREADS
697701 errno = 0 ;
702+ #if defined(MS_WIN64 ) || defined(MS_WINDOWS )
703+ n = read (self -> fd , ptr , (int )size );
704+ #else
698705 n = read (self -> fd , ptr , size );
706+ #endif
699707 Py_END_ALLOW_THREADS
700708 } else
701709 n = -1 ;
You can’t perform that action at this time.
0 commit comments