Skip to content

Commit

Permalink
pythongh-117641: Improve the perfornance of posixpath.commonpath() (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
nineteendo authored Apr 18, 2024
1 parent 6078f20 commit b848b94
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Lib/posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def commonpath(paths):
split_paths = [path.split(sep) for path in paths]

try:
isabs, = set(p[:1] == sep for p in paths)
isabs, = {p.startswith(sep) for p in paths}
except ValueError:
raise ValueError("Can't mix absolute and relative paths") from None

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Speedup :func:`os.path.commonpath` on Unix.

0 comments on commit b848b94

Please sign in to comment.