mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
gh-117641: Improve the perfornance of posixpath.commonpath() (#117652)
This commit is contained in:
parent
6078f2033e
commit
b848b944bb
2 changed files with 2 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue