Sure it will do if one of the processes needs read access only. Scenario when you need shared rw acces with locking: In the file you have "records" say 30 bytes long, 2 processes are reading/writing these records by: lock-read-unlock or lock-write-unlock . Both processes have to open the file with rw access. But the third process can overwrite the locked file! Actually the common method to prevent file from been overwritten is: lock the region outside the file. Such feacure is added to lock/unlock namely for this purpose.
You found the bug in WIN32. PS. When you copy the file (say c:\b) over file with locked region say (c:\a), the length of the file c:\b becomes the length of c:\a, and the content of c:\a is all zeroes. By the way, I would understand the logic if copy copyes bytes outside locked regions but preserves all locks. -- http://mail.python.org/mailman/listinfo/python-list