def makedirs(path, exist_ok=False, mode=None): path = fspath_py35(path) if mode is None: _makedirs(path, exist_ok=exist_ok) return umask = os.umask(0) try: _makedirs(path, exist_ok=exist_ok, mode=mode) finally: os.umask(umask)
def makedirs(path, exist_ok=False, mode=None): path = fspath_py35(path) if mode is None: _makedirs(path, exist_ok=exist_ok) return # utilize umask to set proper permissions since Python 3.7 the `mode` # `makedirs` argument no longer affects the file permission bits of # newly-created intermediate-level directories. umask = os.umask(0o777 - mode) try: _makedirs(path, exist_ok=exist_ok) finally: os.umask(umask)