Skip to content

Commit ffbb6f7

Browse files
authored
bpo-29619: Do not use HAVE_LARGEFILE_SUPPORT for type conversions (GH-1666) (#3102)
Use only the LongLong form for the conversions (cherry picked from commit 50e8603)
1 parent 78c66a6 commit ffbb6f7

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

Modules/posixmodule.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1934,14 +1934,8 @@ _pystat_fromstructstat(STRUCT_STAT *st)
19341934
return NULL;
19351935

19361936
PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long)st->st_mode));
1937-
#if defined(HAVE_LARGEFILE_SUPPORT) || defined(MS_WINDOWS)
19381937
Py_BUILD_ASSERT(sizeof(unsigned long long) >= sizeof(st->st_ino));
1939-
PyStructSequence_SET_ITEM(v, 1,
1940-
PyLong_FromUnsignedLongLong(st->st_ino));
1941-
#else
1942-
Py_BUILD_ASSERT(sizeof(unsigned long) >= sizeof(st->st_ino));
1943-
PyStructSequence_SET_ITEM(v, 1, PyLong_FromUnsignedLong(st->st_ino));
1944-
#endif
1938+
PyStructSequence_SET_ITEM(v, 1, PyLong_FromUnsignedLongLong(st->st_ino));
19451939
#ifdef MS_WINDOWS
19461940
PyStructSequence_SET_ITEM(v, 2, PyLong_FromUnsignedLong(st->st_dev));
19471941
#else
@@ -1955,12 +1949,8 @@ _pystat_fromstructstat(STRUCT_STAT *st)
19551949
PyStructSequence_SET_ITEM(v, 4, _PyLong_FromUid(st->st_uid));
19561950
PyStructSequence_SET_ITEM(v, 5, _PyLong_FromGid(st->st_gid));
19571951
#endif
1958-
#ifdef HAVE_LARGEFILE_SUPPORT
1959-
PyStructSequence_SET_ITEM(v, 6,
1960-
PyLong_FromLongLong((long long)st->st_size));
1961-
#else
1962-
PyStructSequence_SET_ITEM(v, 6, PyLong_FromLong(st->st_size));
1963-
#endif
1952+
Py_BUILD_ASSERT(sizeof(long long) >= sizeof(st->st_size));
1953+
PyStructSequence_SET_ITEM(v, 6, PyLong_FromLongLong(st->st_size));
19641954

19651955
#if defined(HAVE_STAT_TV_NSEC)
19661956
ansec = st->st_atim.tv_nsec;
@@ -11484,11 +11474,8 @@ DirEntry_inode(DirEntry *self)
1148411474
Py_BUILD_ASSERT(sizeof(unsigned long long) >= sizeof(self->win32_file_index));
1148511475
return PyLong_FromUnsignedLongLong(self->win32_file_index);
1148611476
#else /* POSIX */
11487-
#ifdef HAVE_LARGEFILE_SUPPORT
11488-
return PyLong_FromLongLong((long long)self->d_ino);
11489-
#else
11490-
return PyLong_FromLong((long)self->d_ino);
11491-
#endif
11477+
Py_BUILD_ASSERT(sizeof(unsigned long long) >= sizeof(self->d_ino));
11478+
return PyLong_FromUnsignedLongLong(self->d_ino);
1149211479
#endif
1149311480
}
1149411481

0 commit comments

Comments
 (0)