mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
This commit is contained in:
parent
18d1924987
commit
f2f373f593
12 changed files with 242 additions and 180 deletions
|
@ -503,13 +503,13 @@ signal_siginterrupt(PyObject *self, PyObject *args)
|
|||
static PyObject *
|
||||
signal_set_wakeup_fd(PyObject *self, PyObject *args)
|
||||
{
|
||||
struct _Py_stat_struct st;
|
||||
#ifdef MS_WINDOWS
|
||||
PyObject *fdobj;
|
||||
SOCKET_T sockfd, old_sockfd;
|
||||
int res;
|
||||
int res_size = sizeof res;
|
||||
PyObject *mod;
|
||||
struct stat st;
|
||||
int is_socket;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "O:set_wakeup_fd", &fdobj))
|
||||
|
@ -520,7 +520,6 @@ signal_set_wakeup_fd(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
#else
|
||||
int fd, old_fd;
|
||||
struct stat st;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "i:set_wakeup_fd", &fd))
|
||||
return NULL;
|
||||
|
@ -560,7 +559,7 @@ signal_set_wakeup_fd(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (fstat(fd, &st) != 0) {
|
||||
if (_Py_fstat(fd, &st) != 0) {
|
||||
PyErr_SetFromErrno(PyExc_OSError);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -592,7 +591,7 @@ signal_set_wakeup_fd(PyObject *self, PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (fstat(fd, &st) != 0) {
|
||||
if (_Py_fstat(fd, &st) != 0) {
|
||||
PyErr_SetFromErrno(PyExc_OSError);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue