bpo-29619: Convert st_ino using unsigned integer (#557) · python/cpython@0f6d733 (original) (raw)
`@@ -1927,11 +1927,13 @@ _pystat_fromstructstat(STRUCT_STAT *st)
`
1927
1927
`return NULL;
`
1928
1928
``
1929
1929
`PyStructSequence_SET_ITEM(v, 0, PyLong_FromLong((long)st->st_mode));
`
1930
``
`-
#ifdef HAVE_LARGEFILE_SUPPORT
`
``
1930
`+
#if defined(HAVE_LARGEFILE_SUPPORT) || defined(MS_WINDOWS)
`
``
1931
`+
Py_BUILD_ASSERT(sizeof(unsigned long long) >= sizeof(st->st_ino));
`
1931
1932
`PyStructSequence_SET_ITEM(v, 1,
`
1932
``
`-
PyLong_FromLongLong((long long)st->st_ino));
`
``
1933
`+
PyLong_FromUnsignedLongLong(st->st_ino));
`
1933
1934
`#else
`
1934
``
`-
PyStructSequence_SET_ITEM(v, 1, PyLong_FromLong((long)st->st_ino));
`
``
1935
`+
Py_BUILD_ASSERT(sizeof(unsigned long) >= sizeof(st->st_ino));
`
``
1936
`+
PyStructSequence_SET_ITEM(v, 1, PyLong_FromUnsignedLong(st->st_ino));
`
1935
1937
`#endif
`
1936
1938
`#ifdef MS_WINDOWS
`
1937
1939
`PyStructSequence_SET_ITEM(v, 2, PyLong_FromUnsignedLong(st->st_dev));
`
`@@ -11152,7 +11154,7 @@ typedef struct {
`
11152
11154
`PyObject *lstat;
`
11153
11155
`#ifdef MS_WINDOWS
`
11154
11156
`struct _Py_stat_struct win32_lstat;
`
11155
``
`-
__int64 win32_file_index;
`
``
11157
`+
uint64_t win32_file_index;
`
11156
11158
`int got_file_index;
`
11157
11159
`#else /* POSIX */
`
11158
11160
`#ifdef HAVE_DIRENT_D_TYPE
`
`@@ -11409,7 +11411,8 @@ os_DirEntry_inode_impl(DirEntry *self)
`
11409
11411
`self->win32_file_index = stat.st_ino;
`
11410
11412
`self->got_file_index = 1;
`
11411
11413
` }
`
11412
``
`-
return PyLong_FromLongLong((long long)self->win32_file_index);
`
``
11414
`+
Py_BUILD_ASSERT(sizeof(unsigned long long) >= sizeof(self->win32_file_index));
`
``
11415
`+
return PyLong_FromUnsignedLongLong(self->win32_file_index);
`
11413
11416
`#else /* POSIX */
`
11414
11417
`#ifdef HAVE_LARGEFILE_SUPPORT
`
11415
11418
`return PyLong_FromLongLong((long long)self->d_ino);
`