Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
raise TypeError for non-sequences
  • Loading branch information
nineteendo committed Mar 24, 2024
commit 0c38276ed948199ee0695d48ef5d93e0b25091cc
6 changes: 3 additions & 3 deletions Lib/posixpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,11 @@ def relpath(path, start=None):

def commonpath(paths):
"""Given a sequence of path names, returns the longest common sub-path."""
if not paths:
_, roots, tails = zip(*map(splitroot, paths))
if not roots:
raise ValueError('commonpath() arg is an empty sequence')

try:
_, roots, tails = zip(*map(splitroot, paths))
prefix = min(roots)
except (TypeError, AttributeError):
genericpath._check_arg_types('commonpath', *paths)
Expand Down Expand Up @@ -577,4 +577,4 @@ def commonpath(paths):
else:
common = s1

return prefix + sep.join(common)
return prefix + sep.join(common)