]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-76960: Fix urljoin() and urldefrag() for URIs with empty components (GH-123273)
authorSerhiy Storchaka <storchaka@gmail.com>
Sat, 31 Aug 2024 09:42:08 +0000 (12:42 +0300)
committerGitHub <noreply@github.com>
Sat, 31 Aug 2024 09:42:08 +0000 (12:42 +0300)
commitfc897fcc01964649f023e0baa4c95d142e4e8a10
tree225e7086273594100c09c34c09d03f8291911024
parente5a567b0a721c26c79530249d9aa159afbd11955
gh-76960: Fix urljoin() and urldefrag() for URIs with empty components (GH-123273)

* urljoin() with relative reference "?" sets empty query and removes fragment.
* Preserve empty components (authority, params, query, fragment) in urljoin().
* Preserve empty components (authority, params, query) in urldefrag().

Also refactor the code and get rid of double _coerce_args() and
_coerce_result() calls in urljoin(), urldefrag(), urlparse() and
urlunparse().
Lib/test/test_urlparse.py
Lib/urllib/parse.py
Misc/NEWS.d/next/Library/2024-08-23-22-01-30.gh-issue-76960.vsANPu.rst [new file with mode: 0644]