We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b31eaa1 commit b07cbb8Copy full SHA for b07cbb8
CHANGES/1422.misc.rst
@@ -0,0 +1 @@
1
+Improved performance of converting :class:`~yarl.URL` to a string -- by :user:`bdraco`.
yarl/_parse.py
@@ -145,10 +145,10 @@ def unsplit_result(
145
"""Unsplit a URL without any normalization."""
146
if netloc or (scheme and scheme in USES_AUTHORITY) or url[:2] == "//":
147
if url and url[:1] != "/":
148
- url = f"//{netloc or ''}/{url}"
+ url = f"{scheme}://{netloc}/{url}" if scheme else f"{scheme}:{url}"
149
else:
150
- url = f"//{netloc or ''}{url}"
151
- if scheme:
+ url = f"{scheme}://{netloc}{url}" if scheme else f"//{netloc}{url}"
+ elif scheme:
152
url = f"{scheme}:{url}"
153
if query:
154
url = f"{url}?{query}"
0 commit comments