Uh oh!
There was an error while loading. Please reload this page.
GH-107465: Add pathlib.Path.from_uri() classmethod. - #107640
Conversation
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
barneygale
commented
Sep 30, 2023
Thanks for your feedback, both. I've revised the code: We could add a non-strict mode, but I think that's best done in a separate PR that also considers |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
barneygale
commented
Oct 1, 2023
Thank you for the reviews, Adam, Andreas and Edgar! |
bedevere-bot
commented
Oct 1, 2023
|
bedevere-bot
commented
Oct 1, 2023
|
bedevere-bot
commented
Oct 1, 2023
|
…07640) 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>
This method supports file URIs (including variants) as described in RFC 8089, such as URIs generated by
pathlib.Path.as_uri()andurllib.request.pathname2url().The method is added to
Pathrather thanPurePathbecause it usesos.fsdecode(), and so its results vary from system to system. I intend to deprecatePurePath.as_uri()and move it toPathfor the same reason.pathlib.Path.from_uri()classmethod #107465📚 Documentation preview 📚: https://cpython-previews--107640.org.readthedocs.build/