gh-117641: Improve the perfornance of posixpath.commonpath() (#117652)

This commit is contained in:
Nice Zombies 2024-04-18 09:26:34 +02:00 committed by GitHub
parent 6078f2033e
commit b848b944bb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View file

@ -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

View file

@ -0,0 +1 @@
Speedup :func:`os.path.commonpath` on Unix.