Skip to content

Commit 65e6bab

Browse files
committed
win32: Replace win32file._get_osfhandle with function from msvcrt module
1 parent 7f3cd13 commit 65e6bab

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

roundup/backends/portalocker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
if os.name == 'nt':
4545
import win32file
4646
import pywintypes
47+
import msvcrt
4748
LOCK_SH = 0 # the default
4849
LOCK_NB = 0x1 # LOCKFILE_FAIL_IMMEDIATELY
4950
LOCK_EX = 0x2 # LOCKFILE_EXCLUSIVE_LOCK
@@ -61,7 +62,7 @@
6162
# eugh, we want 0xffff0000 here, but python 2.3 won't let us :(
6263
FFFF0000 = -65536
6364
def lock(file, flags):
64-
hfile = win32file._get_osfhandle(file.fileno())
65+
hfile = msvcrt.get_osfhandle(file.fileno())
6566
# LockFileEx is not supported on all Win32 platforms (Win95, Win98,
6667
# WinME).
6768
# If it's not supported, win32file will raise an exception.
@@ -104,7 +105,7 @@ def lock(file, flags):
104105
# TODO: should this return the result of the lock?
105106

106107
def unlock(file):
107-
hfile = win32file._get_osfhandle(file.fileno())
108+
hfile = msvcrt.get_osfhandle(file.fileno())
108109
# UnlockFileEx is not supported on all Win32 platforms (Win95, Win98,
109110
# WinME).
110111
# If it's not supported, win32file will raise an api_error exception.

0 commit comments

Comments
 (0)