Skip to content

Commit 6c0e650

Browse files
author
Richard Jones
committed
reversing the "make it nicer" checkin
1 parent b2d39e5 commit 6c0e650

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

roundup/backends/locking.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,26 @@
1919
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2020
# SOFTWARE.
2121

22-
# $Id: locking.py,v 1.5 2003-02-14 00:08:32 richard Exp $
22+
# $Id: locking.py,v 1.6 2003-02-20 22:56:49 richard Exp $
2323

2424
'''This module provides a generic interface to acquire and release
2525
exclusive access to a file.
2626
2727
It should work on Unix and Windows.
2828
'''
2929

30+
# portalocker has a 0xffff0000 constant, and I don't need to know about it
31+
# being positive in 2.4+ :)
32+
try:
33+
x=FutureWarning
34+
import warnings
35+
warnings.filterwarnings("ignore",
36+
r'hex/oct constants > sys\.maxint .*', FutureWarning,
37+
'portalocker', 0)
38+
del x
39+
except:
40+
pass
41+
3042
import portalocker
3143

3244
def acquire_lock(path, block=1):

roundup/backends/portalocker.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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

118118
elif os.name =='posix':
119119
def lock(file, flags):

0 commit comments

Comments
 (0)