Skip to content

Commit

Permalink
DNM: test hit rate of a join cache
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Nov 29, 2024
1 parent 22544b1 commit 366fa5a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions yarl/_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,12 @@ def join(self, url: "URL") -> "URL":
"""
if type(url) is not URL:
raise TypeError("url should be URL")
# Make sure the argument is a URL so we do not pollute the cache
# with invalid URLs
return self._join(url)

@lru_cache
def _join(self, url: "URL") -> "URL":
scheme = url._scheme or self._scheme
if scheme != self._scheme or scheme not in USES_RELATIVE:
return url
Expand Down

0 comments on commit 366fa5a

Please sign in to comment.