[Python-Dev] Tests failing on Windows with TESTFN
eryksun at gmail.com
Sat Jul 28 18:02:20 EDT 2018
On Sat, Jul 28, 2018 at 5:20 PM, Tim Golden <mail at timgolden.me.uk> wrote:
> I've got a mixture of Permission (winerror 13) & Access errors (winerror 5)
EACCES (13) is a CRT errno value. Python raises PermissionError for
EACCES and EPERM (1, not used). It also does the reverse mapping for
WinAPI calls, so PermissionError is raised either way. About 25 WinAPI
error codes map to EACCES. Commonly it's due to either
ERROR_ACCESS_DENIED (5) or ERROR_SHARING_VIOLATION (32).
open() uses read-write sharing but not delete sharing. In this case
trying to either delete an already open file or open a file that's
already open with delete access (e.g. an O_TEMPORARY open) both fail
with a sharing violation.
An access-denied error could be due to a range of causes. Over 20
NTAPI status codes map to ERROR_ACCESS_DENIED. Commonly for a file
it's due to one of the following status codes:
The file security doesn't grant the requested access
to the caller.
The file's delete disposition is set, i.e. it's flagged to be
deleted when the last handle is closed. Opening a new
handle is disallowed for any access.
Except when using backup semantics, CreateFile calls
NtCreateFile with the flag FILE_NON_DIRECTORY_FILE,
so only non-directory files/devices can be opened.
The file is either readonly or memory mapped.
More information about the Python-Dev