22# Requires python 1.5.2 or better.
33
44# ID line added by richard for Roundup file tracking
5- # $Id: portalocker.py,v 1.4 2003-02-14 00:08:32 richard Exp $
5+ # $Id: portalocker.py,v 1.5 2003-02-20 22:56:49 richard Exp $
66
77""" Cross-platform (posix/nt) API for flock-style file locking.
88
@@ -67,7 +67,7 @@ def lock(file, flags):
6767 # Try LockFileEx first, as it has more functionality and handles
6868 # blocking locks more efficiently.
6969 try :
70- win32file .LockFileEx (hfile , flags , 0 , 0xffff0000L , __overlapped )
70+ win32file .LockFileEx (hfile , flags , 0 , 0xffff0000 , __overlapped )
7171 except win32file .error , e :
7272 import winerror
7373 # Propagate upwards all exceptions other than not-implemented.
@@ -82,14 +82,14 @@ def lock(file, flags):
8282 warnings .warn ("PortaLocker does not support shared locking on Win9x" , RuntimeWarning )
8383 # LockFile only supports immediate-fail locking.
8484 if flags & LOCK_NB :
85- win32file .LockFile (hfile , 0 , 0 , 0xffff0000L , 0 )
85+ win32file .LockFile (hfile , 0 , 0 , 0xffff0000 , 0 )
8686 else :
8787 # Emulate a blocking lock with a polling loop.
8888 import time
8989 while 1 :
9090 # Attempt a lock.
9191 try :
92- win32file .LockFile (hfile , 0 , 0 , 0xffff0000L , 0 )
92+ win32file .LockFile (hfile , 0 , 0 , 0xffff0000 , 0 )
9393 break
9494 except win32file .error , e :
9595 # Propagate upwards all exceptions other than lock violation.
@@ -104,7 +104,7 @@ def unlock(file):
104104 # UnlockFileEx is not supported on all Win32 platforms (Win95, Win98, WinME).
105105 # If it's not supported, win32file will raise an api_error exception.
106106 try :
107- win32file .UnlockFileEx (hfile , 0 , 0xffff0000L , __overlapped )
107+ win32file .UnlockFileEx (hfile , 0 , 0xffff0000 , __overlapped )
108108 except win32file .error , e :
109109 import winerror
110110 # Propagate upwards all exceptions other than not-implemented.
@@ -113,7 +113,7 @@ def unlock(file):
113113
114114 # UnlockFileEx is not supported. Use UnlockFile.
115115 # Care: the low/high length params are reversed compared to UnLockFileEx.
116- win32file .UnlockFile (hfile , 0 , 0 , 0xffff0000L , 0 )
116+ win32file .UnlockFile (hfile , 0 , 0 , 0xffff0000 , 0 )
117117
118118elif os .name == 'posix' :
119119 def lock (file , flags ):
0 commit comments