Eryk Sun <eryk...@gmail.com> added the comment: FYI, here's a sampling of successful calls that modify the last error value.
Most Create- functions intentionally set the last error to 0 on success, such as CreateFile, CreateFileMapping, CreateSymbolicLink, CreateJobObject, CreateEvent, CreateMutex, CreateSemaphore, and CreateWaitableTimer. Some other functions also intentionally set the last error to 0 on success, such as SetWaitableTimer and the functions that work with security identifiers (SIDs) such as EqualSid, GetLengthSid, GetSidIdentifierAuthority, and GetSidSubAuthority. The return value of some functions is the low DWORD of a file size, such as GetCompressedFileSize, GetFileSize, and SetFilePointer. In this case 0xFFFFFFFF is either a valid size or indicates an error. The function is forced to clarify this by setting the last error to 0 on success. GetFileSizeEx and SetFilePointerEx are preferred, since they don't have this problem. Some functions make internal calls to CreateFile or DeviceIoControl. These cases might even set the last error to a non-zero value on success. Examples include GetVolumePathName (e.g. ERROR_MORE_DATA from DeviceIoControl), GetFinalPathNameByHandle (opening "\\.\MountPointManager"), and GetDriveType (e.g. for junction mountpoints). ---------- nosy: +eryksun _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33030> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com