diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-10-26 17:08:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-26 17:08:41 (GMT) |
commit | e25d8b40cd70744513e190b1ca153087382b6b09 (patch) | |
tree | 634476faa50efccd53e53b8f40dea82b5c64c01f | |
parent | 78c6faee08eb832b6eafe85340ca95e1e92f6402 (diff) | |
download | cpython-e25d8b40cd70744513e190b1ca153087382b6b09.zip cpython-e25d8b40cd70744513e190b1ca153087382b6b09.tar.gz cpython-e25d8b40cd70744513e190b1ca153087382b6b09.tar.bz2 |
GH-111293: Fix DirEntry.inode dropping higher bits on Windows (GH-111294)
(cherry picked from commit b468538d356552f0242763fe44a17b1939e8bd55)
Co-authored-by: zcxsythenew <30565051+zcxsythenew@users.noreply.github.com>
-rw-r--r-- | Misc/NEWS.d/next/Windows/2023-10-25-05-01-28.gh-issue-111293.FSsLT6.rst | 1 | ||||
-rw-r--r-- | Modules/posixmodule.c | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/Misc/NEWS.d/next/Windows/2023-10-25-05-01-28.gh-issue-111293.FSsLT6.rst b/Misc/NEWS.d/next/Windows/2023-10-25-05-01-28.gh-issue-111293.FSsLT6.rst new file mode 100644 index 0000000..4c6b255 --- /dev/null +++ b/Misc/NEWS.d/next/Windows/2023-10-25-05-01-28.gh-issue-111293.FSsLT6.rst @@ -0,0 +1 @@ +Fix :data:`os.DirEntry.inode` dropping higher 64 bits of a file id on some filesystems on Windows. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index b332939..265c817 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -14528,6 +14528,7 @@ typedef struct { #ifdef MS_WINDOWS struct _Py_stat_struct win32_lstat; uint64_t win32_file_index; + uint64_t win32_file_index_high; int got_file_index; #else /* POSIX */ #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_high = stat.st_ino_high; self->got_file_index = 1; } - static_assert(sizeof(unsigned long long) >= sizeof(self->win32_file_index), - "DirEntry.win32_file_index is larger than unsigned long long"); - return PyLong_FromUnsignedLongLong(self->win32_file_index); + return _pystat_l128_from_l64_l64(self->win32_file_index, self->win32_file_index_high); #else /* POSIX */ static_assert(sizeof(unsigned long long) >= sizeof(self->d_ino), "DirEntry.d_ino is larger than unsigned long long"); |