gh-86533: Restore os.makedirs() ability to apply *mode* recursively#150011
Open
nessita wants to merge 13 commits into
Open
gh-86533: Restore os.makedirs() ability to apply *mode* recursively#150011nessita wants to merge 13 commits into
nessita wants to merge 13 commits into
Conversation
Allow os.makedirs() to apply the *mode* argument to any intermediate directories that are created.
- Replace recursive_mode with more intuitive parent_mode parameter - parent_mode=None (default): intermediate dirs use default permissions - parent_mode=<mode>: intermediate dirs use specified permissions - parent_mode=mode: matches Python 3.6 behavior - Update documentation with version markers and usage examples - Add comprehensive test coverage with separate focused test functions - Fix test permissions to avoid cleanup issues (0o555 → 0o705) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add parent_mode parameter to Path.mkdir() for specifying intermediate directory permissions when parents=True - Maintain pathlib's independence by using recursive implementation rather than delegating to os.makedirs - Add comprehensive tests including umask behavior verification - Update documentation and whatsnew entries - Provides consistency with os.makedirs parent_mode parameter 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Use st_mode & 0o777 masking instead of stat.S_IMODE() to ignore filesystem-specific bits like setgid, matching the approach used in os.makedirs tests. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Author
|
@gpshead Hi! This is the PR we talked abut with the conflict fixed. |
Documentation build overview
4 files changed± library/os.html± library/pathlib.html± whatsnew/3.15.html± whatsnew/changelog.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.