8000 GH-111293: Fix DirEntry.inode dropping higher bits on Windows (GH-111… · python/cpython@e25d8b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit e25d8b4

Browse files
GH-111293: Fix DirEntry.inode dropping higher bits on Windows (GH-111294)
(cherry picked from commit b468538) Co-authored-by: zcxsythenew <30565051+zcxsythenew@users.noreply.github.com>
1 parent 78c6fae commit e25d8b4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix :data:`os.DirEntry.inode` dropping higher 64 bits of a file id on some filesystems on Windows.

Modules/posixmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14528,6 +14528,7 @@ typedef struct {
1452814528
#ifdef MS_WINDOWS
1452914529
struct _Py_stat_struct win32_lstat;
1453014530
uint64_t win32_file_index;
14531+
uint64_t win32_file_index_high;
1453114532
int got_file_index;
1453214533
#else /* POSIX */
1453314534
#ifdef HAVE_DIRENT_D_TYPE
@@ -14859,11 +14860,10 @@ os_DirEntry_inode_impl(DirEntry *self)
1485914860
}
1486014861

1486114862
self->win32_file_index = stat.st_ino;
14863+
self->win32_file_index_high = stat.st_ino_high;
1486214864
self->got_file_index = 1;
1486314865
}
14864-
static_assert(sizeof(unsigned long long) >= sizeof(self->win32_file_index),
14865-
"DirEntry.win32_file_index is larger than unsigned long long");
14866-
return PyLong_FromUnsignedLongLong(self->win32_file_index);
14866+
return _pystat_l128_from_l64_l64(self->win32_file_index, self->win32_file_index_high);
1486714867
#else /* POSIX */
1486814868
static_assert(sizeof(unsigned long long) >= sizeof(self->d_ino),
1486914869
"DirEntry.d_ino is larger than unsigned long long");

0 commit comments

Comments
 (0)
0