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.2.4
1010Core and Builtins
1111-----------------
1212
13+ - Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB.
14+
1315- Issue #16455: On FreeBSD and Solaris, if the locale is C, the
1416 ASCII/surrogateescape codec is now used, instead of the locale encoding, to
1517 decode the command line arguments. This change fixes inconsistencies with
Original file line number Diff line number Diff line change @@ -558,7 +558,7 @@ fileio_readall(fileio *self)
558558{
559559 PyObject * result ;
560560 Py_ssize_t total = 0 ;
561- int n ;
561+ Py_ssize_t n ;
562562
563563 if (self -> fd < 0 )
564564 return err_closed ();
@@ -591,9 +591,18 @@ fileio_readall(fileio *self)
591591 }
592592 Py_BEGIN_ALLOW_THREADS
593593 errno = 0 ;
594+ n = newsize - total ;
595+ #if defined(MS_WIN64 ) || defined(MS_WINDOWS )
596+ if (n > INT_MAX )
597+ n = INT_MAX ;
598+ n = read (self -> fd ,
599+ PyBytes_AS_STRING (result ) + total ,
600+ (int )n );
601+ #else
594602 n = read (self -> fd ,
595603 PyBytes_AS_STRING (result ) + total ,
596- newsize - total );
604+ n );
605+ #endif
597606 Py_END_ALLOW_THREADS
598607 if (n == 0 )
599608 break ;
You can’t perform that action at this time.
0 commit comments