makedirs: fix mode flag is being ignored starting from Python 3.7

This commit is contained in:
Ivan Shcheklein
2019-11-13 14:12:01 -08:00
parent c1bbd8dcc0
commit 2b934470b4
+2 -2
View File
@@ -152,9 +152,9 @@ def makedirs(path, exist_ok=False, mode=None):
_makedirs(path, exist_ok=exist_ok)
return
umask = os.umask(0)
umask = os.umask(0o777 - mode)
try:
_makedirs(path, exist_ok=exist_ok, mode=mode)
_makedirs(path, exist_ok=exist_ok)
finally:
os.umask(umask)