GeezerVison is showing github.com — gh-150885: Remove unused shutil._ensure_directory by gaborbernat · Pull Request #150883 · python/cpython
Conversation
gaborbernat
commented
Jun 3, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
shutil._ensure_directory() arrived in #8295 with shutil.unpack_archive(), where it created the parent directory of each extracted member. The ZIP path-traversal fix in gh-146581 (GH-146591) reworked _unpack_zipfile() to create directories inline and removed the last call to it, so the private helper now has no caller.
Nothing in the repository references the name outside its own definition, found by a word-boundary search across Lib, Modules, Python, Objects, and Include, and a GitHub code search turns up no downstream importer.
_ensure_directory is private and undocumented, so this has no user-facing effect and needs no Misc/NEWS.d entry. The skip news label applies.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Introduced in python#8295 alongside shutil.unpack_archive() as a helper that
created the parent directory of each extracted member.
Orphaned by pythongh-146581 (pythonGH-146591), the ZIP path-traversal fix, which
reworked _unpack_zipfile() to create directories inline and deleted the
last _ensure_directory(targetpath) call site in the same change.
Since then the private helper has had no caller: a word-boundary search
across Lib, Modules, Python, Objects and Include finds zero references
outside its own definition, and a GitHub code search finds no downstream
importers.
gaborbernat
changed the title
gh-150882: Remove unused shutil._ensure_directory
gh-150885: Remove unused shutil._ensure_directory
Jun 3, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
giampaolo
Awaiting requested review from giampaolo
giampaolo is a code owner
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|