[Python-checkins] bpo-6689: os.path.commonpath raises ValueError for different drives isn't documented (GH-14045)

Miss Islington (bot) webhook-mailer at python.org
Thu Jun 13 10:13:16 EDT 2019


https://github.com/python/cpython/commit/ec3839a215a68cf35ff1f90cb6823f67a5abdce3
commit: ec3839a215a68cf35ff1f90cb6823f67a5abdce3
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2019-06-13T07:12:49-07:00
summary:

bpo-6689: os.path.commonpath raises ValueError for different drives isn't documented (GH-14045)


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
(cherry picked from commit 95492032c48fef20b9c7076a23fe7e46927a4688)

Co-authored-by: Makdon <makdon at makdon.me>

files:
M Doc/library/os.path.rst

diff --git a/Doc/library/os.path.rst b/Doc/library/os.path.rst
index 8e7ee8bfe784..a673b81278ea 100644
--- a/Doc/library/os.path.rst
+++ b/Doc/library/os.path.rst
@@ -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.
 



More information about the Python-checkins mailing list