8000 fix: file lock on windows · qiniu/python-sdk@b6fd793 · GitHub
[go: up one dir, main page]

Skip to content

Commit b6fd793

Browse files
committed
fix: file lock on windows
1 parent e33c0e1 commit b6fd793

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

qiniu/http/regions_provider.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,12 @@ def __init__(self, fd):
211211

212212
def __enter__(self):
213213
try:
214-
# TODO(lihs): set `_nbyte` bigger?
215-
msvcrt.locking(self._fd, msvcrt.LK_LOCK | msvcrt.LK_NBLCK, 1)
214+
msvcrt.locking(self._fd.fileno(), msvcrt.LK_LOCK | msvcrt.LK_NBLCK, 1)
216215
except OSError:
217216
raise FileAlreadyLocked('File {0} already locked'.format(self._file_path))
218217

219218
def __exit__(self, exc_type, exc_val, exc_tb):
220-
msvcrt.locking(self._fd, msvcrt.LK_UNLCK, 1)
219+
msvcrt.locking(self._fd.fileno(), msvcrt.LK_UNLCK, 1)
221220

222221
@property
223222
def _file_path(self):

0 commit comments

Comments
 (0)
0