File tree Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Expand file tree Collapse file tree 4 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 11Changelog
22=========
3+ v3.10.2 (2023-03-22)
4+ --------------------
5+ - Bug fix for using filelock with threaded programs causing undesired file permissions - by :user: `jahrules `.
6+
37v3.10.1 (2023-03-22)
48--------------------
59- Handle pickle for :class: `filelock.Timeout ` :pr: `203 ` - by :user: `TheMatt2 `.
Original file line number Diff line number Diff line change @@ -179,11 +179,7 @@ def acquire(
179179 with self ._thread_lock :
180180 if not self .is_locked :
181181 _LOGGER .debug ("Attempting to acquire lock %s on %s" , lock_id , lock_filename )
182- previous_umask = os .umask (0 )
183- try :
184- self ._acquire ()
185- finally :
186- os .umask (previous_umask ) # reset umask to initial value
182+ self ._acquire ()
187183 if self .is_locked :
188184 _LOGGER .debug ("Lock %s acquired on %s" , lock_id , lock_filename )
189185 break
Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ class UnixFileLock(BaseFileLock):
3232
3333 def _acquire (self ) -> None :
3434 open_flags = os .O_RDWR | os .O_CREAT | os .O_TRUNC
35- fd = os .open (self ._lock_file , open_flags , self ._mode )
35+ fd = os .open (self ._lock_file , open_flags )
36+ os .chmod (fd , self ._mode )
3637 try :
3738 fcntl .flock (fd , fcntl .LOCK_EX | fcntl .LOCK_NB )
3839 except OSError :
Original file line number Diff line number Diff line change @@ -440,7 +440,10 @@ def test_lock_mode_soft(tmp_path: Path) -> None:
440440 assert lock .is_locked
441441
442442 mode = filemode (os .stat (lock_path ).st_mode )
443- assert mode == "-rw-rw-rw-"
443+ if sys .platform == "win32" :
444+ assert mode == "-rw-rw-rw-"
445+ else :
446+ assert mode == "-rw-r--r--"
444447
445448 lock .release ()
446449
You can’t perform that action at this time.
0 commit comments