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.04:22:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1432268557.03.0.564375193324.issue22107@psf.upfronthosting.co.za>
In-reply-to
Content
Shouldn't it be checking whether `file` (or `filename`) is a directory [1]? For example:

    except PermissionError:
        # This exception is thrown when a directory with
        # the chosen name already exists on windows.
        if _os.name == 'nt' and _os.path.isdir(file):
            continue
        # If the directory allows write access, continue 
        # trying names. On Windows, currently this test 
        # doesn't work. The implementation assumes all 
        # directories allow write access, but it really 
        # depends on the directory's discretionary and 
        # system access control lists (DACL & SACL).
        elif _os.access(dir, _os.W_OK):
            continue
        else:
            raise

---

[1]: Windows sets the last error to ERROR_ACCESS_DENIED when a system
     call returns the NTSTATUS code STATUS_FILE_IS_A_DIRECTORY. This
     status code is returned by NtCreateFile and NtOpenFile when the
     target file is a directory, but the caller asked for anything 
     but a directory (i.e. CreateOptions contains 
     FILE_NON_DIRECTORY_FILE).
History
Date User Action Args
2015-05-22 04:22:37eryksunsetrecipients: + eryksun, georg.brandl, paul.moore, ncoghlan, rupole, tim.golden, BreamoreBoy, python-dev, zach.ware, serhiy.storchaka, steve.dower
2015-05-22 04:22:37eryksunsetmessageid: <1432268557.03.0.564375193324.issue22107@psf.upfronthosting.co.za>
2015-05-22 04:22:37eryksunlinkissue22107 messages
2015-05-22 04:22:36eryksuncreate