]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-123599: `url2pathname()`: handle authority section in file URL (#126844)
authorBarney Gale <barney.gale@gmail.com>
Thu, 10 Apr 2025 19:58:04 +0000 (20:58 +0100)
committerGitHub <noreply@github.com>
Thu, 10 Apr 2025 19:58:04 +0000 (19:58 +0000)
commit66cdb2bd8ab93a4691bead7f5d1e54e5ca6895b4
tree56a74cd71eac1a452b2efecdccf9b0ac1ed074f3
parenta214db0c5406254d293f33622ce2cbd8233b52a5
GH-123599: `url2pathname()`: handle authority section in file URL (#126844)

In `urllib.request.url2pathname()`, if the authority resolves to the
current host, discard it. If an authority is present but resolves somewhere
else, then on Windows we return a UNC path (as before), and on other
platforms we raise `URLError`.

Affects `pathlib.Path.from_uri()` in the same way.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Doc/library/pathlib.rst
Doc/library/urllib.request.rst
Doc/whatsnew/3.14.rst
Lib/pathlib/__init__.py
Lib/test/test_pathlib/test_pathlib.py
Lib/test/test_urllib.py
Lib/urllib/request.py
Misc/NEWS.d/next/Library/2024-11-14-21-17-48.gh-issue-126838.Yr5vKF.rst [new file with mode: 0644]