summaryrefslogtreecommitdiff
path: root/Modules/_io
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-10-17 23:58:40 -0700
committerGitHub <noreply@github.com>2018-10-17 23:58:40 -0700
commit178d1c07778553bf66e09fe0bb13796be3fb9abf (patch)
tree30bb65bdf044cefc0dc90c46ebbf5ddc50876650 /Modules/_io
parent35ae99d7b394af0ce01460f7bccd7449a82289ad (diff)
downloadcpython-git-178d1c07778553bf66e09fe0bb13796be3fb9abf.tar.gz
bpo-24658: Fix read/write greater than 2 GiB on macOS (GH-1705)
On macOS, fix reading from and writing into a file with a size larger than 2 GiB. (cherry picked from commit 74a8b6ea7e0a8508b13a1c75ec9b91febd8b5557) Co-authored-by: Stéphane Wirtel <stephane@wirtel.be>
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/fileio.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 0d5bf3b221..8bbe1ce367 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -791,11 +791,9 @@ _io_FileIO_read_impl(fileio *self, Py_ssize_t size)
if (size < 0)
return _io_FileIO_readall_impl(self);
-#ifdef MS_WINDOWS
- /* On Windows, the count parameter of read() is an int */
- if (size > INT_MAX)
- size = INT_MAX;
-#endif
+ if (size > _PY_READ_MAX) {
+ size = _PY_READ_MAX;
+ }
bytes = PyBytes_FromStringAndSize(NULL, size);
if (bytes == NULL)