diff options
author | Barney Gale <barney.gale@gmail.com> | 2023-10-01 15:14:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-01 15:14:02 (GMT) |
commit | 15de493395c3251b8b82063bbe22a379792b9404 (patch) | |
tree | 15ab6a3a86eb413ea6c2c708dda48e4384f07f16 /Misc | |
parent | 06faa9a39bd93c5e7999d52b52043ecdd0774dac (diff) | |
download | cpython-15de493395c3251b8b82063bbe22a379792b9404.zip cpython-15de493395c3251b8b82063bbe22a379792b9404.tar.gz cpython-15de493395c3251b8b82063bbe22a379792b9404.tar.bz2 |
GH-107465: Add `pathlib.Path.from_uri()` classmethod. (#107640)
This method supports file URIs (including variants) as described in RFC 8089, such as URIs generated by `pathlib.Path.as_uri()` and `urllib.request.pathname2url()`.
The method is added to `Path` rather than `PurePath` because it uses `os.fsdecode()`, and so its results vary from system to system. I intend to deprecate `PurePath.as_uri()` and move it to `Path` for the same reason.
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2023-08-04-19-00-53.gh-issue-107465.Vc1Il3.rst | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2023-08-04-19-00-53.gh-issue-107465.Vc1Il3.rst b/Misc/NEWS.d/next/Library/2023-08-04-19-00-53.gh-issue-107465.Vc1Il3.rst new file mode 100644 index 0000000..e98092f --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-08-04-19-00-53.gh-issue-107465.Vc1Il3.rst @@ -0,0 +1 @@ +Add :meth:`pathlib.Path.from_uri` classmethod. |