| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
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.
|
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.
|
Thanks @barneygale for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, something went wrong.
…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 <barney.gale@gmail.com>
|
GH-119750 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
…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 <barney.gale@gmail.com>
…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()`.
…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()`.
| Back | FazBrowse Home | New Git URL |
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.