mirror of
https://github.com/python/cpython
synced 2024-09-16 06:09:56 +00:00
gh-117641: Improve the perfornance of posixpath.commonpath() (#117652)
This commit is contained in:
parent
6078f2033e
commit
b848b944bb
|
@ -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
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Speedup :func:`os.path.commonpath` on Unix.
|
Loading…
Reference in a new issue