Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-99726: Add 'fast' argument to os.[l]stat for faster calculation#99727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
987198314ed8ef25b3352b37dca4e8670e2bb714972b1571eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #ifndef Py_INTERNAL_FILEUTILS_WINDOWS_H | ||
| #define Py_INTERNAL_FILEUTILS_WINDOWS_H | ||
| #ifdef __cplusplus | ||
| extern "C"{ | ||
| #endif | ||
| #ifndef Py_BUILD_CORE | ||
| # error "Py_BUILD_CORE must be defined to include this header" | ||
| #endif | ||
| #ifdef MS_WINDOWS | ||
| #if !defined(NTDDI_WIN10_NI) || !(NTDDI_VERSION >= NTDDI_WIN10_NI) | ||
| typedef struct _FILE_STAT_BASIC_INFORMATION{ | ||
| LARGE_INTEGER FileId; | ||
| LARGE_INTEGER CreationTime; | ||
| LARGE_INTEGER LastAccessTime; | ||
| LARGE_INTEGER LastWriteTime; | ||
| LARGE_INTEGER ChangeTime; | ||
| LARGE_INTEGER AllocationSize; | ||
| LARGE_INTEGER EndOfFile; | ||
| ULONG FileAttributes; | ||
| ULONG ReparseTag; | ||
| ULONG NumberOfLinks; | ||
| ULONG DeviceType; | ||
| ULONG DeviceCharacteristics; | ||
| } FILE_STAT_BASIC_INFORMATION; | ||
| typedef enum _FILE_INFO_BY_NAME_CLASS{ | ||
| FileStatByNameInfo, | ||
| FileStatLxByNameInfo, | ||
| FileCaseSensitiveByNameInfo, | ||
| FileStatBasicByNameInfo, | ||
| MaximumFileInfoByNameClass | ||
| } FILE_INFO_BY_NAME_CLASS; | ||
| #endif | ||
| typedef BOOL (WINAPI *PGetFileInformationByName)( | ||
| PCWSTR FileName, | ||
| FILE_INFO_BY_NAME_CLASS FileInformationClass, | ||
| PVOID FileInfoBuffer, | ||
| ULONG FileInfoBufferSize | ||
| ); | ||
| static inline BOOL GetFileInformationByName( | ||
| PCWSTR FileName, | ||
| FILE_INFO_BY_NAME_CLASS FileInformationClass, | ||
| PVOID FileInfoBuffer, | ||
| ULONG FileInfoBufferSize | ||
| ){ | ||
| static PGetFileInformationByName GetFileInformationByName = NULL; | ||
| static int GetFileInformationByName_init = -1; | ||
| if (GetFileInformationByName_init < 0){ | ||
| HMODULE hMod = LoadLibraryW(L"api-ms-win-core-file-l2-1-4"); | ||
| GetFileInformationByName_init = 0; | ||
| if (hMod){ | ||
| GetFileInformationByName = (PGetFileInformationByName)GetProcAddress( | ||
| hMod, "GetFileInformationByName"); | ||
| if (GetFileInformationByName){ | ||
| GetFileInformationByName_init = 1; | ||
| } else{ | ||
| FreeLibrary(hMod); | ||
| } | ||
| } | ||
| } | ||
| if (GetFileInformationByName_init <= 0){ | ||
| SetLastError(ERROR_NOT_SUPPORTED); | ||
| return FALSE; | ||
| } | ||
| return GetFileInformationByName(FileName, FileInformationClass, FileInfoBuffer, FileInfoBufferSize); | ||
| } | ||
| #endif | ||
| #endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😆 whoops
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, no, this is correct. There's a
fastargument to this function, which gets passed through (it just doesn't happen to make any difference right now, but that's whyfastdoesn't guarantee it'll leave out any information. Sometimes we have to take the slow path regardless, and that's the case here.)Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, right, I missed that :) Never mind then