From 549d465fe2fe5ec85ed51cf7f7bf7f5b3d91e59b Mon Sep 17 00:00:00 2001 From: Giampaolo Rodola' Date: Thu, 3 Jan 2013 02:54:27 +0100 Subject: [PATCH 1/2] issue 10527: fix missing import --- Lib/multiprocessing/connection.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/multiprocessing/connection.py b/Lib/multiprocessing/connection.py index f083c54d2a6..f73faf66b29 100644 --- a/Lib/multiprocessing/connection.py +++ b/Lib/multiprocessing/connection.py @@ -41,6 +41,7 @@ import errno import time import tempfile import itertools +import select import _multiprocessing from multiprocessing import current_process, AuthenticationError From c44057dfbdb4e4f651e7cc4761aa63b7e8d128c3 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 3 Jan 2013 03:33:21 +0100 Subject: [PATCH 2/2] Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB --- Misc/NEWS | 2 ++ Modules/_io/fileio.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Misc/NEWS b/Misc/NEWS index fdd372d993e..fdb6fa835b4 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,8 @@ What's New in Python 3.2.4 Core and Builtins ----------------- +- Issue #16367: Fix FileIO.readall() on Windows for files larger than 2 GB. + - Issue #16455: On FreeBSD and Solaris, if the locale is C, the ASCII/surrogateescape codec is now used, instead of the locale encoding, to decode the command line arguments. This change fixes inconsistencies with diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c index 605ad51e355..8ea7c58aa8c 100644 --- a/Modules/_io/fileio.c +++ b/Modules/_io/fileio.c @@ -558,7 +558,7 @@ fileio_readall(fileio *self) { PyObject *result; Py_ssize_t total = 0; - int n; + Py_ssize_t n; if (self->fd < 0) return err_closed(); @@ -591,9 +591,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;