GeezerVison is showing github.com — GH-119169: Implement `pathlib.Path.walk()` using `os.walk()` by barneygale · Pull Request #119573 · python/cpython
Conversation
barneygale
commented
May 26, 2024
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
For silly reasons, pathlib's generic implementation of walk() currently resides in glob._Globber. This commit moves it into pathlib._abc.PathBase.walk() where it really belongs, and makes pathlib.Path.walk() call though to os.walk() rather than using the generic impl.
Symlink handling is a little different between the two walk() implementations when followlinks=False. In pathlib it means never following symlinks, not even for distinguishing between files and directories. In os it means never walking into symlinks, including any symlinks created by the user between iterations. We smooth over these differences with a private sentinel - os._walk_symlinks_as_files - that enables the pathlib behaviour.
No change of behaviour.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
For silly reasons, pathlib's generic implementation of `walk()` currently
resides in `glob._Globber`. This commit moves it into
`pathlib._abc.PathBase.walk()` where it really belongs, and makes
`pathlib.Path.walk()` call though to `os.walk()`.
Symlink handling is a little different between the two `walk()`
implementations when `followlinks=False`. In `pathlib` it means never
following symlinks, not even for distinguishing between files and
directories. In `os` it means never *walking* into symlinks, including any
symlinks created by the user between iterations. We smooth over these
differences with a private sentinel - `os._walk_symlinks_as_files` - that
enables the pathlib behaviour.
barneygale
commented
May 29, 2024
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
I'm intensely embarrassed by my decision to add a _Globber.walk() method to glob.py despite it having little to do with globbing, and so I'm going to merge this PR before anyone else notices my poor life choices.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @barneygale for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
May 29, 2024
…ythonGH-119573)
For silly reasons, pathlib's generic implementation of `walk()` currently
resides in `glob._Globber`. This commit moves it into
`pathlib._abc.PathBase.walk()` where it really belongs, and makes
`pathlib.Path.walk()` call `os.walk()`.
(cherry picked from commit 7ff61f5)
Co-authored-by: Barney Gale <[email protected]>
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
barneygale
added a commit
that referenced
this pull request
May 29, 2024
…H-119573) (#119750)
GH-119169: Implement `pathlib.Path.walk()` using `os.walk()` (GH-119573)
For silly reasons, pathlib's generic implementation of `walk()` currently
resides in `glob._Globber`. This commit moves it into
`pathlib._abc.PathBase.walk()` where it really belongs, and makes
`pathlib.Path.walk()` call `os.walk()`.
(cherry picked from commit 7ff61f5)
Co-authored-by: Barney Gale <[email protected]>
estyxx
pushed a commit
to estyxx/cpython
that referenced
this pull request
Jul 17, 2024
…ython#119573)
For silly reasons, pathlib's generic implementation of `walk()` currently
resides in `glob._Globber`. This commit moves it into
`pathlib._abc.PathBase.walk()` where it really belongs, and makes
`pathlib.Path.walk()` call `os.walk()`.
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.
|