]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-86533: Restore os.makedirs() ability to apply *mode* recursively (GH-150011...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 19 May 2026 05:10:01 +0000 (07:10 +0200)
committerGitHub <noreply@github.com>
Tue, 19 May 2026 05:10:01 +0000 (22:10 -0700)
commit28f275f713124a1425effe3c998394e829b20db7
treee710921cf677987ffaec4a46914b861a5d0e9c86
parentd36e08099d56a54028174429a946c9816f284374
[3.15] gh-86533: Restore os.makedirs() ability to apply *mode* recursively (GH-150011) (#150036)

bpo-42367: Restore os.makedirs() and pathlib.mkdir() ability to apply *mode* recursively via a new parent_mode= keyword argument.
(cherry picked from commit 9770e32ce07110f0c8c7a381604ec9a490028eed)

+ Make Path.mkdir parent_mode tests umask-independent

test_mkdir_with_parent_mode, test_mkdir_parent_mode_deep_hierarchy and
test_mkdir_parent_mode_same_as_mode assert exact directory mode bits but
did not pin the process umask.  On buildbots running with a restrictive
umask (e.g. 0o077) the 0o755 leaf was masked down to 0o700, failing the
assertions.  Wrap them in os_helper.temp_umask(0o022), matching the
other umask-aware mkdir tests in this file.

---------

Co-authored-by: nessita <124304+nessita@users.noreply.github.com>
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Erlend E. Aasland <erlend@python.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Doc/library/os.rst
Doc/library/pathlib.rst
Doc/whatsnew/3.15.rst
Lib/os.py
Lib/pathlib/__init__.py
Lib/test/test_os/test_os.py
Lib/test/test_pathlib/test_pathlib.py
Misc/NEWS.d/next/Library/2025-08-30-07-44-30.gh-issue-86533.pathlib.rst [new file with mode: 0644]