Eryk Sun <eryk...@gmail.com> added the comment:

> 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).

----------
nosy: +eryksun
resolution:  -> third party
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36736>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to