Message 340985 - Python tracker

Message340985

Author eryksun
Recipients eryksun, paul.moore, steve.dower, terry.reedy, tim.golden, yapydev, zach.ware
Date 2019-04-27.14:25:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1556375147.44.0.779573427904.issue36736@roundup.psfhosted.org>
In-reply-to
Content
> win32file.LockFileEx(h, win32con.LOCKFILE_EXCLUSIVE_LOCK, 5, 5, None)

This is a third-party issue in the PyWin32 package. win32file.LockFileEx shouldn't allow passing None for the required 5th parameter `ol` (i.e. the lpOverlapped parameter of WINAPI LockFileEx [1]). Or at least it should allocate a default overlapped record in this case, with the offset set to 0. Passing a NULL pointer leads to an access-violation exception.

[1]: https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-lockfileex

FYI, setting a lock on the file is unecessary in this case. You created the kernel file object without data-access sharing (i.e. shareMode == 0). Until the handle is closed, opening the file again with read or write data access will fail as a sharing violation (32).
History
Date User Action Args
2019-04-27 14:25:47eryksunsetrecipients: + eryksun, terry.reedy, paul.moore, tim.golden, zach.ware, steve.dower, yapydev
2019-04-27 14:25:47eryksunsetmessageid: <1556375147.44.0.779573427904.issue36736@roundup.psfhosted.org>
2019-04-27 14:25:47eryksunlinkissue36736 messages
2019-04-27 14:25:46eryksuncreate