cpython/Lib/pathlib
Barney Gale d88677ac20
GH-128520: More consistent type-checking behaviour in pathlib (#130199)
In the following methods, skip casting of the argument to a path object if
the argument has a `with_segments` attribute. In `PurePath`:
`relative_to()`, `is_relative_to()`, `match()`, and `full_match()`. In
`Path`: `rename()`, `replace()`, `copy()`, `copy_into()`, `move()`, and
`move_into()`.

Previously the check varied a bit from method to method. The `PurePath`
methods used `isinstance(arg, PurePath)`; the `rename()` and `replace()`
methods always cast, and the remaining `Path` methods checked for a private
`_copy_writer` attribute.

We apply identical changes to relevant methods of the private ABCs. This
improves performance a bit, because `isinstance()` checks on ABCs are
expensive.
2025-02-21 17:47:45 +00:00
..
__init__.py GH-127807: pathlib ABCs: remove PathBase._unsupported_msg() (#127855) 2024-12-12 17:39:24 +00:00
_abc.py GH-128520: More consistent type-checking behaviour in pathlib (#130199) 2025-02-21 17:47:45 +00:00
_local.py GH-128520: More consistent type-checking behaviour in pathlib (#130199) 2025-02-21 17:47:45 +00:00
_os.py GH-125413: Add private metadata methods to pathlib.Path.info (#129897) 2025-02-17 19:15:25 +00:00
types.py GH-125413: Add pathlib.Path.info attribute (#127730) 2025-02-08 01:16:45 +00:00