[issue22107] tempfile module misinterprets access denied error on Windows
eryksun
report at bugs.python.org
Fri May 22 08:58:55 CEST 2015
eryksun added the comment:
Ok, I think I understand now. You chose an indirect check to avoid the race condition. If we have write access to the directory, then the PermissionError must be because a directory exists with the same name.
Unfortunately os.access doesn't currently tell us this information. Moreover, checking `isdir(dir) and access(dir, W_OK)` is actually redundant as things currently stand. If `isdir` returns True that means GetFileAttributes didn't fail, which means `access` must return True as designed:
return_value = (attr != INVALID_FILE_ATTRIBUTES) &&
( !(mode & 2) ||
!(attr & FILE_ATTRIBUTE_READONLY) ||
(attr & FILE_ATTRIBUTE_DIRECTORY) );
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22107>
_______________________________________
More information about the Python-bugs-list
mailing list