]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-77609: Add recurse_symlinks argument to `pathlib.Path.glob()` (#117311)
authorBarney Gale <barney.gale@gmail.com>
Fri, 5 Apr 2024 18:51:54 +0000 (19:51 +0100)
committerGitHub <noreply@github.com>
Fri, 5 Apr 2024 18:51:54 +0000 (18:51 +0000)
commit6150bb2412eb5ca3b330ccb9f0636949c7526a7f
tree627dc7282bd5eb5ab2998c5d652b46dbdd77ecc6
parent4d4a6f1b6aea6dae131ac116f1735a38c3e32cd1
GH-77609: Add recurse_symlinks argument to `pathlib.Path.glob()` (#117311)

Replace tri-state `follow_symlinks` with boolean `recurse_symlinks` argument. The new argument controls whether symlinks are followed when expanding recursive `**` wildcards. The possible argument values correspond as follows:

    follow_symlinks  recurse_symlinks
    ===============  ================
    False            N/A
    None             False
    True             True

We therefore drop support for not following symlinks when expanding non-recursive pattern parts; it wasn't requested in the original issue, and it's a feature not found in any shells.

This makes the API a easier to grok by eliminating `None` as an option.

No news blurb as `follow_symlinks` was new in 3.13.
Doc/library/pathlib.rst
Doc/whatsnew/3.13.rst
Lib/pathlib/__init__.py
Lib/pathlib/_abc.py
Lib/test/test_pathlib/test_pathlib_abc.py