Skip to content

gh-153390: Document pathlib with_segments path duck typing - #153394

Open
dimaqq wants to merge 1 commit into
python:mainfrom
dimaqq:agent-document-pathlib-with-segments-duck-typing
Open

gh-153390: Document pathlib with_segments path duck typing#153394
dimaqq wants to merge 1 commit into
python:mainfrom
dimaqq:agent-document-pathlib-with-segments-duck-typing

Conversation

@dimaqq

@dimaqqdimaqq commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

This updates the pathlib.PurePath.with_segments() documentation to describe
the Python 3.14 behavior added in gh-128520 / GH-130199.

Some pathlib methods now use the presence of a with_segments attribute to
decide whether an argument is already a path object. If the attribute is
present, the argument is used directly; otherwise, it is converted through
with_segments(). This is relevant for authors of pathlib subclasses and
third-party path-like/path-adjacent objects.

Validation:

  • git diff --check
  • env PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 make -C Doc check
  • make -C Doc html SPHINXOPTS='-W --keep-going -q'

Notes:

  • No NEWS entry is included because this is a documentation-only change.
  • Running make -C Doc check without PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
    failed while building a pre-commit dependency (regress) because PyO3 0.26.0
    does not yet recognize Python 3.15.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33509299 | 📁 Comparing 6a1df84 against main (f3fd9dc)

🔍 Preview build

1 file changed
±library/pathlib.html

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviewdocsDocumentation in the Doc dirskip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

1 participant

@dimaqq