diff options
author | Barney Gale <barney.gale@gmail.com> | 2023-12-08 17:39:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-08 17:39:04 (GMT) |
commit | 76929fdeebc5f89655a7a535c19fdcece9728a7d (patch) | |
tree | b4d9f023e4b7951d60caadb58ada10a5b21279f2 /Misc | |
parent | 5a0137ca34deb6e1e2e890a52cb4b22d645c166b (diff) | |
download | cpython-76929fdeebc5f89655a7a535c19fdcece9728a7d.zip cpython-76929fdeebc5f89655a7a535c19fdcece9728a7d.tar.gz cpython-76929fdeebc5f89655a7a535c19fdcece9728a7d.tar.bz2 |
GH-110109: Add `pathlib._PurePathBase` (#110670)
Add private `pathlib._PurePathBase` class: a private superclass of both `PurePath` and `_PathBase`. Unlike `PurePath`, it does not define any of these special methods: `__fspath__`, `__bytes__`, `__reduce__`, `__hash__`, `__eq__`, `__lt__`, `__le__`, `__gt__`, `__ge__`. Its initializer and path joining methods accept only strings, not os.PathLike objects more broadly.
This is important for supporting *virtual paths*: user subclasses of `_PathBase` that provide access to archive files, FTP servers, etc. In these classes, the above methods should be implemented by users only as appropriate, with due consideration for the hash/equality of any backing objects, such as file objects or sockets.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2023-10-11-02-34-01.gh-issue-110109.RFCmHs.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-10-11-02-34-01.gh-issue-110109.RFCmHs.rst b/Misc/NEWS.d/next/Library/2023-10-11-02-34-01.gh-issue-110109.RFCmHs.rst new file mode 100644 index 0000000..4f12d12 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-10-11-02-34-01.gh-issue-110109.RFCmHs.rst @@ -0,0 +1,3 @@ +Add private ``pathlib._PurePathBase`` class: a base class for +:class:`pathlib.PurePath` that omits certain magic methods. It may be made +public (along with ``_PathBase``) in future. |