]> git.tokkee.org Git - roundup.git/commitdiff

Code

nicer work-around for the 32-bit int problem
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Fri, 14 Feb 2003 00:08:32 +0000 (00:08 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Fri, 14 Feb 2003 00:08:32 +0000 (00:08 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1508 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/backends/locking.py
roundup/backends/portalocker.py

index 3899253b61f7dae905ecaceb6c75d4971ccc23d3..0799bb5c4e9fcdbc3c7788960fc5c15a5f7edb41 100644 (file)
@@ -19,7 +19,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-# $Id: locking.py,v 1.4 2003-02-06 09:40:21 richard Exp $
+# $Id: locking.py,v 1.5 2003-02-14 00:08:32 richard Exp $
 
 '''This module provides a generic interface to acquire and release
 exclusive access to a file.
@@ -27,16 +27,6 @@ exclusive access to a file.
 It should work on Unix and Windows.
 '''
 
-try:
-    x=FutureWarning
-    import warnings
-    warnings.filterwarnings("ignore",
-        r'hex/oct constants > sys\.maxint .*', FutureWarning,
-        'portalocker', 0)
-    del x
-except:
-    pass
-
 import portalocker
 
 def acquire_lock(path, block=1):
index 219ae24043536e054235b5af37bc0c708e2a760e..daf8b0fcebb3449746dc2f82cbdd93778d14540f 100644 (file)
@@ -2,7 +2,7 @@
 #                  Requires python 1.5.2 or better.
 
 # ID line added by richard for Roundup file tracking
-# $Id: portalocker.py,v 1.3 2003-01-19 23:14:42 richard Exp $
+# $Id: portalocker.py,v 1.4 2003-02-14 00:08:32 richard Exp $
 
 """ Cross-platform (posix/nt) API for flock-style file locking.
 
@@ -67,7 +67,7 @@ if os.name == 'nt':
         # Try LockFileEx first, as it has more functionality and handles
         # blocking locks more efficiently.
         try:
-            win32file.LockFileEx(hfile, flags, 0, 0xffff0000, __overlapped)
+            win32file.LockFileEx(hfile, flags, 0, 0xffff0000L, __overlapped)
         except win32file.error, e:
             import winerror
             # Propagate upwards all exceptions other than not-implemented.
@@ -82,14 +82,14 @@ if os.name == 'nt':
                 warnings.warn("PortaLocker does not support shared locking on Win9x", RuntimeWarning)
             # LockFile only supports immediate-fail locking.
             if flags & LOCK_NB:
-                win32file.LockFile(hfile, 0, 0, 0xffff0000, 0)
+                win32file.LockFile(hfile, 0, 0, 0xffff0000L, 0)
             else:
                 # Emulate a blocking lock with a polling loop.
                 import time
                 while 1:
                     # Attempt a lock.
                     try:
-                        win32file.LockFile(hfile, 0, 0, 0xffff0000, 0)
+                        win32file.LockFile(hfile, 0, 0, 0xffff0000L, 0)
                         break
                     except win32file.error, e:
                         # Propagate upwards all exceptions other than lock violation.
@@ -104,7 +104,7 @@ if os.name == 'nt':
         # UnlockFileEx is not supported on all Win32 platforms (Win95, Win98, WinME).
         # If it's not supported, win32file will raise an api_error exception.
         try:
-            win32file.UnlockFileEx(hfile, 0, 0xffff0000, __overlapped)
+            win32file.UnlockFileEx(hfile, 0, 0xffff0000L, __overlapped)
         except win32file.error, e:
             import winerror
             # Propagate upwards all exceptions other than not-implemented.
@@ -113,7 +113,7 @@ if os.name == 'nt':
             
             # UnlockFileEx is not supported. Use UnlockFile.
             # Care: the low/high length params are reversed compared to UnLockFileEx.
-            win32file.UnlockFile(hfile, 0, 0, 0xffff0000, 0)
+            win32file.UnlockFile(hfile, 0, 0, 0xffff0000L, 0)
 
 elif os.name =='posix':
     def lock(file, flags):