]> granicus.if.org Git - python/commitdiff
bpo-6689: os.path.commonpath raises ValueError for different drives isn't documented...
authorMakdon <makdon@makdon.me>
Thu, 13 Jun 2019 13:59:49 +0000 (21:59 +0800)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 13 Jun 2019 13:59:49 +0000 (06:59 -0700)
It would raise ValueError("Paths don't have the same drive") if the paths on different drivers, which is not documented.

os.path.commonpath raises ValueError when the *paths* are in different drivers, but it is not documented.
Update the document according @Windsooon 's suggestion.
It actually raise ValueError according line 355 of [test of path](https://github.com/python/cpython/blob/master/Lib/test/test_ntpath.py)

https://bugs.python.org/issue6689

Doc/library/os.path.rst

index 8e7ee8bfe7845fe6a5b6d3933a16f2052f31dff2..a673b81278ea7442fcd1bf91d182bbae6b9412de 100644 (file)
@@ -87,9 +87,10 @@ the :mod:`glob` module.)
 .. function:: commonpath(paths)
 
    Return the longest common sub-path of each pathname in the sequence
-   *paths*.  Raise :exc:`ValueError` if *paths* contains both absolute and relative
-   pathnames, or if *paths* is empty.  Unlike :func:`commonprefix`, this
-   returns a valid path.
+   *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
+   valid path.
 
    .. availability:: Unix, Windows.