summaryrefslogtreecommitdiffstats
path: root/Python/fileutils.c
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2023-05-24 23:16:13 (GMT)
committerGitHub <noreply@github.com>2023-05-24 23:16:13 (GMT)
commit6031727a37c6003f78e3b0c7414a0a214855dd08 (patch)
tree7a43a3130d0bdd10d6cbd98caa91e6d7e9973c4a /Python/fileutils.c
parent087c1a6539eac330372a8b759bf3e2d472f6148a (diff)
downloadcpython-6031727a37c6003f78e3b0c7414a0a214855dd08.zip
cpython-6031727a37c6003f78e3b0c7414a0a214855dd08.tar.gz
cpython-6031727a37c6003f78e3b0c7414a0a214855dd08.tar.bz2
gh-104820: Fixes os.stat on Windows to better handle file systems that do not support FileIdInformation (GH-104892)
Diffstat (limited to 'Python/fileutils.c')
-rw-r--r--Python/fileutils.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 969b716..f137ee9 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -1132,7 +1132,8 @@ _Py_attribute_data_to_stat(BY_HANDLE_FILE_INFORMATION *info, ULONG reparse_tag,
file_id.id = id_info->FileId;
result->st_ino = file_id.st_ino;
result->st_ino_high = file_id.st_ino_high;
- } else {
+ }
+ if (!result->st_ino && !result->st_ino_high) {
/* should only occur for DirEntry_from_find_data, in which case the
index is likely to be zero anyway. */
result->st_ino = (((uint64_t)info->nFileIndexHigh) << 32) + info->nFileIndexLow;