mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
GH-111293: Fix DirEntry.inode dropping higher bits on Windows (GH-111294)
(cherry picked from commit b468538d35
)
Co-authored-by: zcxsythenew <30565051+zcxsythenew@users.noreply.github.com>
This commit is contained in:
parent
78c6faee08
commit
e25d8b40cd
2 changed files with 4 additions and 3 deletions
|
@ -0,0 +1 @@
|
||||||
|
Fix :data:`os.DirEntry.inode` dropping higher 64 bits of a file id on some filesystems on Windows.
|
|
@ -14528,6 +14528,7 @@ typedef struct {
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
struct _Py_stat_struct win32_lstat;
|
struct _Py_stat_struct win32_lstat;
|
||||||
uint64_t win32_file_index;
|
uint64_t win32_file_index;
|
||||||
|
uint64_t win32_file_index_high;
|
||||||
int got_file_index;
|
int got_file_index;
|
||||||
#else /* POSIX */
|
#else /* POSIX */
|
||||||
#ifdef HAVE_DIRENT_D_TYPE
|
#ifdef HAVE_DIRENT_D_TYPE
|
||||||
|
@ -14859,11 +14860,10 @@ os_DirEntry_inode_impl(DirEntry *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
self->win32_file_index = stat.st_ino;
|
self->win32_file_index = stat.st_ino;
|
||||||
|
self->win32_file_index_high = stat.st_ino_high;
|
||||||
self->got_file_index = 1;
|
self->got_file_index = 1;
|
||||||
}
|
}
|
||||||
static_assert(sizeof(unsigned long long) >= sizeof(self->win32_file_index),
|
return _pystat_l128_from_l64_l64(self->win32_file_index, self->win32_file_index_high);
|
||||||
"DirEntry.win32_file_index is larger than unsigned long long");
|
|
||||||
return PyLong_FromUnsignedLongLong(self->win32_file_index);
|
|
||||||
#else /* POSIX */
|
#else /* POSIX */
|
||||||
static_assert(sizeof(unsigned long long) >= sizeof(self->d_ino),
|
static_assert(sizeof(unsigned long long) >= sizeof(self->d_ino),
|
||||||
"DirEntry.d_ino is larger than unsigned long long");
|
"DirEntry.d_ino is larger than unsigned long long");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue