diff options
author | Stéphane Wirtel <stephane@wirtel.be> | 2018-10-17 23:05:04 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@redhat.com> | 2018-10-17 23:05:04 (GMT) |
commit | 74a8b6ea7e0a8508b13a1c75ec9b91febd8b5557 (patch) | |
tree | 2ae2721beb480ede309e03b90202038b63c5a22c /Modules | |
parent | 0f11a88622ceda93a6b7eed7db52a5eb8083445f (diff) | |
download | cpython-74a8b6ea7e0a8508b13a1c75ec9b91febd8b5557.zip cpython-74a8b6ea7e0a8508b13a1c75ec9b91febd8b5557.tar.gz cpython-74a8b6ea7e0a8508b13a1c75ec9b91febd8b5557.tar.bz2 |
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.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_io/fileio.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c index c0e43e0..44d51c9 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) |