Skip to content

Commit

Permalink
gh-102765: Update ntpath.isdir/isfile/islink/exists to use GetFileInf…
Browse files Browse the repository at this point in the history
…ormationByName when available (GH-103485)
  • Loading branch information
finnagin authored Apr 27, 2023
1 parent 8a0c7f1 commit b701dce
Show file tree
Hide file tree
Showing 2 changed files with 209 additions and 118 deletions.
18 changes: 18 additions & 0 deletions Include/internal/pycore_fileutils_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,24 @@ static inline BOOL _Py_GetFileInformationByName(
return GetFileInformationByName(FileName, FileInformationClass, FileInfoBuffer, FileInfoBufferSize);
}

static inline BOOL _Py_GetFileInformationByName_ErrorIsTrustworthy(int error)
{
switch(error) {
case ERROR_FILE_NOT_FOUND:
case ERROR_PATH_NOT_FOUND:
case ERROR_NOT_READY:
case ERROR_BAD_NET_NAME:
case ERROR_BAD_NETPATH:
case ERROR_BAD_PATHNAME:
case ERROR_INVALID_NAME:
case ERROR_FILENAME_EXCED_RANGE:
return TRUE;
case ERROR_NOT_SUPPORTED:
return FALSE;
}
return FALSE;
}

#endif

#endif
Loading

0 comments on commit b701dce

Please sign in to comment.