Issue #28075: Fix test_access_denied in Python 3.5
I forgot there two variations of os.stat() in Python 3.5.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index becf654..c993fb6 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1607,7 +1607,9 @@
/* Either the target doesn't exist, or we don't have access to
get a handle to it. If the former, we need to return an error.
If the latter, we can use attributes_from_dir. */
- if (GetLastError() != ERROR_SHARING_VIOLATION)
+ DWORD lastError = GetLastError();
+ if (lastError != ERROR_ACCESS_DENIED &&
+ lastError != ERROR_SHARING_VIOLATION)
return -1;
/* Could not get attributes on open file. Fall back to
reading the directory. */
@@ -1617,7 +1619,7 @@
if (info.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
if (traverse) {
/* Should traverse, but could not open reparse point handle */
- SetLastError(ERROR_SHARING_VIOLATION);
+ SetLastError(lastError);
return -1;
}
}