From 6a1df84f55d9b42bf1bd114a887b7229769e2db6 Mon Sep 17 00:00:00 2001 From: Dima Tisnek Date: Thu, 9 Jul 2026 15:26:53 +0900 Subject: [PATCH] gh-153390: Document pathlib with_segments path duck typing --- Doc/library/pathlib.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index ab92c142c37a4f6..a158a84d09c0ef5 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -746,6 +746,14 @@ Pure paths provide the following methods and properties: .. versionadded:: 3.12 + .. versionchanged:: 3.14 + + Some methods that accept path objects, such as :meth:`match` and + :meth:`~Path.rename`, check for a ``with_segments`` attribute to + determine whether the argument is already a path object. If present, + the argument is used directly; otherwise, it is converted using + ``with_segments()``. + .. _concrete-paths: