File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1010### Fixed
1111
1212- Restored fs.path import
13+ - Fixed potential race condition in makedirs. Fixes [ #310 ] ( https://github.com/PyFilesystem/pyfilesystem2/issues/310 )
1314
1415### Changed
1516
Original file line number Diff line number Diff line change @@ -1067,10 +1067,13 @@ def makedirs(
10671067 with self ._lock :
10681068 dir_paths = tools .get_intermediate_dirs (self , path )
10691069 for dir_path in dir_paths :
1070- self .makedir (dir_path , permissions = permissions )
1071-
1070+ try :
1071+ self .makedir (dir_path , permissions = permissions )
1072+ except errors .DirectoryExists :
1073+ if not recreate :
1074+ raise
10721075 try :
1073- self .makedir (path )
1076+ self .makedir (path , permissions = permissions )
10741077 except errors .DirectoryExists :
10751078 if not recreate :
10761079 raise
You can’t perform that action at this time.
0 commit comments