Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
diff --git a/Modules/main.c b/Modules/main.c
index c4883c9..83538c4 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -752,9 +752,8 @@
}
}
{
- /* XXX: does this work on Win/Win64? (see posix_fstat) */
- struct stat sb;
- if (fstat(fileno(fp), &sb) == 0 &&
+ struct _Py_stat_struct sb;
+ if (_Py_fstat(fileno(fp), &sb) == 0 &&
S_ISDIR(sb.st_mode)) {
fprintf(stderr, "%ls: '%ls' is a directory, cannot continue\n", argv[0], filename);
fclose(fp);