python / python/cpython

Document pathlib with_segments duck typing for path object arguments

オープン
#153,390 コメント 1 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

docs
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Some pathlib methods use the presence of a with_segments attribute to decide whether an argument is already a path object.

This behavior was changed in gh-128520 / GH-130199 for Python 3.14. The main pathlib reference documents PurePath.with_segments(), but it does not currently mention that methods such as PurePath.match() and Path.rename() use with_segments as this duck-typed marker.

This can surprise authors of path-like or path-adjacent classes that define with_segments without implementing os.PathLike. The docs should describe the current behavior so subclass and third-party path authors have a clear contract to work from.

Linked PRs
  • gh-153394

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

pathlib のメインリファレンスにある PurePath.with_segments() のドキュメントから始め、PurePath.match() と Path.rename() への参照を確認してください。with_segments の存在が duck typing によるパスオブジェクトのマーカーとして使用されていることを、パス風クラスおよびパス隣接クラスへの含意も含めて文書化してください。レンダリングされたドキュメントが現在の Python 3.14 の動作を説明していることを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。