mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-114709: Fix exceptions raised by posixpath.commonpath (#114710)
Fix the exceptions raised by posixpath.commonpath Raise ValueError, not IndexError when passed an empty iterable. Raise TypeError, not ValueError when passed None.
This commit is contained in:
parent
f9154f8f23
commit
371c970886
4 changed files with 11 additions and 3 deletions
|
|
@ -79,7 +79,7 @@ the :mod:`glob` module.)
|
|||
|
||||
.. function:: commonpath(paths)
|
||||
|
||||
Return the longest common sub-path of each pathname in the sequence
|
||||
Return the longest common sub-path of each pathname in the iterable
|
||||
*paths*. Raise :exc:`ValueError` if *paths* contain both absolute
|
||||
and relative pathnames, the *paths* are on the different drives or
|
||||
if *paths* is empty. Unlike :func:`commonprefix`, this returns a
|
||||
|
|
@ -90,7 +90,7 @@ the :mod:`glob` module.)
|
|||
.. versionadded:: 3.5
|
||||
|
||||
.. versionchanged:: 3.6
|
||||
Accepts a sequence of :term:`path-like objects <path-like object>`.
|
||||
Accepts an iterable of :term:`path-like objects <path-like object>`.
|
||||
|
||||
|
||||
.. function:: commonprefix(list)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue