Skip to content

Commit

Permalink
Avoid copying list to reverse segments when making children (#1250)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco authored Oct 13, 2024
1 parent 404b542 commit a5de0c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/1250.misc.rst
3 changes: 2 additions & 1 deletion yarl/_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,8 @@ def _make_child(self, paths: "Sequence[str]", encoded: bool = False) -> "URL":
)
path = path if encoded else self._PATH_QUOTER(path)
needs_normalize |= "." in path
segments = list(reversed(path.split("/")))
segments = path.split("/")
segments.reverse()
# remove trailing empty segment for all but the last path
segment_slice_start = int(not last and segments[0] == "")
parsed += segments[segment_slice_start:]
Expand Down

0 comments on commit a5de0c0

Please sign in to comment.