This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eryksun
Recipients BreamoreBoy, eryksun, georg.brandl, ncoghlan, paul.moore, python-dev, rupole, serhiy.storchaka, steve.dower, tim.golden, zach.ware
Date 2015-05-22.06:58:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1432277935.48.0.352888068847.issue22107@psf.upfronthosting.co.za>
In-reply-to
Content
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)   );
History
Date User Action Args
2015-05-22 06:58:55eryksunsetrecipients: + eryksun, georg.brandl, paul.moore, ncoghlan, rupole, tim.golden, BreamoreBoy, python-dev, zach.ware, serhiy.storchaka, steve.dower
2015-05-22 06:58:55eryksunsetmessageid: <1432277935.48.0.352888068847.issue22107@psf.upfronthosting.co.za>
2015-05-22 06:58:55eryksunlinkissue22107 messages
2015-05-22 06:58:55eryksuncreate