Skip to content

Commit 8c26178

Browse files
committed
gh-137894:Fix os.makedirs to properly pass mode parameter to recursive calls
Fixed a bug in `os.makedirs()` where the `mode` parameter was not being passed to recursive calls when creating intermediate directories. This caused only the final directory to receive the specified permissions, while all intermediate directories would use the default mode of `0o777`.
1 parent 9face21 commit 8c26178

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/os.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ def makedirs(name, mode=0o777, exist_ok=False):
215215
head, tail = path.split(head)
216216
if head and tail and not path.exists(head):
217217
try:
218-
makedirs(head, exist_ok=exist_ok)
218+
makedirs(head, mode, exist_ok=exist_ok)
219219
except FileExistsError:
220220
# Defeats race condition when another thread created the path
221221
pass

0 commit comments

Comments
 (0)