]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
pathlib ABCs: support initializing paths with no arguments (#126608)
authorBarney Gale <barney.gale@gmail.com>
Sat, 9 Nov 2024 18:21:53 +0000 (18:21 +0000)
committerGitHub <noreply@github.com>
Sat, 9 Nov 2024 18:21:53 +0000 (18:21 +0000)
commit0f47a3199c51ba7c49e72b4c645dbf599aa17be4
tree0af8152972d48f0b6f379fb5f6c7761e868d897b
parent6293d00e7201f3f28b1f4512e57dc4f03855cabd
pathlib ABCs: support initializing paths with no arguments (#126608)

In the past I've equivocated about whether to require at least one argument
in the `PurePathBase` (and `PathBase`) initializer, and what the default
should be if we make it optional. I now have a local use case that has
persuaded me to make it optional and default to the empty string (a
`zipp.Path`-like class that treats relative and absolute paths similarly.)
Happily this brings the base class more in line with `PurePath` and `Path`.
Lib/pathlib/_abc.py
Lib/test/test_pathlib/test_pathlib_abc.py