Skip to content

gh-139580: Clarify pathlib full_match recursive pattern docs#151479

Open
harjothkhara wants to merge 1 commit into
python:mainfrom
harjothkhara:codex/gh-139580-pathlib-full-match-docs
Open

gh-139580: Clarify pathlib full_match recursive pattern docs#151479
harjothkhara wants to merge 1 commit into
python:mainfrom
harjothkhara:codex/gh-139580-pathlib-full-match-docs

Conversation

@harjothkhara

Copy link
Copy Markdown
Contributor

Closes gh-139580.

Summary

Clarify the PurePath.full_match() documentation for recursive ** patterns.
In particular, /a/** matches paths with a slash and following segment such as
/a/b, but not /a itself.

This is a docs-only fix matching the existing pathlib behavior. The blast radius
is limited to Doc/library/pathlib.rst; no runtime behavior changes are made.

Verification

Real behavior check:

./python.exe -c "from pathlib import Path; cases = ('/a', '/a/b', '/a/'); [print(f\"Path({case!r}) normalizes to {str(Path(case))!r}; full_match('/a/**') -> {Path(case).full_match('/a/**')}\") for case in cases]"

Output:

Path('/a') normalizes to '/a'; full_match('/a/**') -> False
Path('/a/b') normalizes to '/a/b'; full_match('/a/**') -> True
Path('/a/') normalizes to '/a'; full_match('/a/**') -> False

Docs checks:

make -C Doc html SOURCES=library/pathlib.rst SPHINXOPTS="-q"
make -C Doc doctest SOURCES=library/pathlib.rst SPHINXOPTS="-q"
git diff --check

Results:

  • make -C Doc html SOURCES=library/pathlib.rst SPHINXOPTS="-q" passed.
  • make -C Doc doctest SOURCES=library/pathlib.rst SPHINXOPTS="-q" passed.
  • git diff --check passed.

@read-the-docs-community

read-the-docs-community Bot commented Jun 14, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33135752 | 📁 Comparing 303854b against main (a700732)

  🔍 Preview build  

1 file changed
± library/pathlib.html

@harjothkhara harjothkhara force-pushed the codex/gh-139580-pathlib-full-match-docs branch from 753a0d3 to 54f4826 Compare June 14, 2026 19:11
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@harjothkhara harjothkhara force-pushed the codex/gh-139580-pathlib-full-match-docs branch from 54f4826 to 303854b Compare June 14, 2026 19:18
@harjothkhara harjothkhara marked this pull request as ready for review June 14, 2026 19:18
@harjothkhara harjothkhara requested a review from barneygale as a code owner June 14, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

/a/** is understood by Path.full_match as /a followed by multiple segments, at least one

1 participant