Edit: too much information for distracting people so I've removed almost everything. This is on windows, python 3.6 using mmap and msvcrt
Code in one python application:
fd = os.open(r'C:\somefile', os.O_CREAT | os.O_RDWR)
mm_file = mmap.mmap(fd, 4096, access=mmap.ACCESS_WRITE)
msvcrt.locking(fd, msvcrt.LK_LOCK, 4096)
Expectation when a second application attempts to open C:\somefile for read/write is to get some kind of an error message that it couldn't access it because it's locked.
What actually happend: the second application accessed it no problem.