Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a2a6477

Browse files
author
Victor Stinner
committed
Fix io.FileIO.readall() on Windows 64 bits
Use Py_off_t type (64 bits) instead of off_t (32 bits).
1 parent 2c5d3cb commit a2a6477

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Modules/_io/fileio.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,12 +552,12 @@ fileio_readinto(fileio *self, PyObject *args)
552552
static size_t
553553
new_buffersize(fileio *self, size_t currentsize
554554
#ifdef HAVE_FSTAT
555-
, off_t pos, off_t end
555+
, Py_off_t pos, Py_off_t end
556556
#endif
557557
)
558558
{
559559
#ifdef HAVE_FSTAT
560-
if (end != (off_t)-1) {
560+
if (end != (Py_off_t)-1) {
561561
/* Files claiming a size smaller than SMALLCHUNK may
562562
actually be streaming pseudo-files. In this case, we
563563
apply the more aggressive algorithm below.
@@ -584,7 +584,7 @@ fileio_readall(fileio *self)
584584
{
585585
#ifdef HAVE_FSTAT
586586
struct stat st;
587-
off_t pos, end;
587+
Py_off_t pos, end;
588588
#endif
589589
PyObject *result;
590590
Py_ssize_t total = 0;
@@ -609,7 +609,7 @@ fileio_readall(fileio *self)
609609
if (fstat(self->fd, &st) == 0)
610610
end = st.st_size;
611611
else
612-
end = (off_t)-1;
612+
end = (Py_off_t)-1;
613613
#endif
614614
while (1) {
615615
#ifdef HAVE_FSTAT

0 commit comments

Comments
 (0)