Mercurial > p > roundup > code
diff roundup/backends/portalocker.py @ 4680:b6b600ff61e2
win32: Replace win32file._get_osfhandle with function from msvcrt module
| author | anatoly techtonik <techtonik@gmail.com> |
|---|---|
| date | Tue, 27 Nov 2012 14:17:05 +0300 |
| parents | d269f5f04f7a |
| children | 6c74a8bff423 |
line wrap: on
line diff
--- a/roundup/backends/portalocker.py Tue Nov 27 13:00:50 2012 +0300 +++ b/roundup/backends/portalocker.py Tue Nov 27 14:17:05 2012 +0300 @@ -44,6 +44,7 @@ if os.name == 'nt': import win32file import pywintypes + import msvcrt LOCK_SH = 0 # the default LOCK_NB = 0x1 # LOCKFILE_FAIL_IMMEDIATELY LOCK_EX = 0x2 # LOCKFILE_EXCLUSIVE_LOCK @@ -61,7 +62,7 @@ # eugh, we want 0xffff0000 here, but python 2.3 won't let us :( FFFF0000 = -65536 def lock(file, flags): - hfile = win32file._get_osfhandle(file.fileno()) + hfile = msvcrt.get_osfhandle(file.fileno()) # LockFileEx is not supported on all Win32 platforms (Win95, Win98, # WinME). # If it's not supported, win32file will raise an exception. @@ -104,7 +105,7 @@ # TODO: should this return the result of the lock? def unlock(file): - hfile = win32file._get_osfhandle(file.fileno()) + hfile = msvcrt.get_osfhandle(file.fileno()) # UnlockFileEx is not supported on all Win32 platforms (Win95, Win98, # WinME). # If it's not supported, win32file will raise an api_error exception.
