mirror of
https://github.com/python/cpython.git
synced 2025-12-09 18:48:05 +00:00
Issue #28075: Fix test_access_denied in Python 3.5
I forgot there two variations of os.stat() in Python 3.5.
This commit is contained in:
parent
17a564ecc9
commit
bf3c1c3235
2 changed files with 18 additions and 14 deletions
|
|
@ -1607,7 +1607,9 @@ win32_xstat_impl_w(const wchar_t *path, struct _Py_stat_struct *result,
|
|||
/* 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 @@ win32_xstat_impl_w(const wchar_t *path, struct _Py_stat_struct *result,
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue