Skip to content

Commit afc0eb3

Browse files
committed
Mark as not locked before releasing the lock
1 parent 0a6e34c commit afc0eb3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bpython/filelock.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ def acquire(self):
8585
raise e
8686

8787
def release(self):
88-
fcntl.flock(self.fileobj, fcntl.LOCK_UN)
8988
self.locked = False
89+
fcntl.flock(self.fileobj, fcntl.LOCK_UN)
9090

9191

9292
class WindowsFileLock(BaseLock):
@@ -101,8 +101,8 @@ def acquire(self):
101101
self.locked = True
102102

103103
def release(self):
104-
msvcrt.locking(self.fileobj.fileno(), msvcrt.LK_UNLCK, 1)
105104
self.locked = False
105+
msvcrt.locking(self.fileobj.fileno(), msvcrt.LK_UNLCK, 1)
106106

107107

108108
if has_fcntl:

0 commit comments

Comments
 (0)