Ticket #9433: locks.py.patch

File locks.py.patch, 861 bytes (added by anonymous, 7 years ago)
  • locks.py

    diff -ru trunk/locks.py work/locks.py
    old new  
    5353        hfile = win32file._get_osfhandle(fd(file))
    5454        win32file.UnlockFileEx(hfile, 0, -0x10000, __overlapped)
    5555elif system_type == 'posix':
     56    def lockf(fd, operation):
     57        try:
     58            fcntl.lockf(fd, operation)
     59        except IOError, e:
     60            if e.errno == 45: # Operation not supported
     61                pass
     62            else:
     63                raise
     64               
    5665    def lock(file, flags):
    57         fcntl.lockf(fd(file), flags)
     66        lockf(fd(file), flags)
    5867
    5968    def unlock(file):
    60         fcntl.lockf(fd(file), fcntl.LOCK_UN)
     69        lockf(fd(file), fcntl.LOCK_UN)
    6170else:
    6271    # File locking is not supported.
    6372    LOCK_EX = LOCK_SH = LOCK_NB = None
Back to Top