Skip to content

Commit

Permalink
Improve performance of URL equality checks
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Oct 17, 2024
1 parent ac2e975 commit edcbd37
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions yarl/_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,11 +478,13 @@ def __eq__(self, other: object) -> bool:

val1 = self._val
if not val1.path and val1.netloc:
val1 = val1._replace(path="/")
scheme, netloc, _, query, fragment = val1
val1 = tuple.__new__(SplitResult, (scheme, netloc, "/", query, fragment))

val2 = other._val
if not val2.path and val2.netloc:
val2 = val2._replace(path="/")
scheme, netloc, _, query, fragment = val2
val2 = tuple.__new__(SplitResult, (scheme, netloc, "/", query, fragment))

return val1 == val2

Expand Down

0 comments on commit edcbd37

Please sign in to comment.