diff options
author | andrei kulakov <andrei.avk@gmail.com> | 2021-09-08 17:24:09 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-08 17:24:09 (GMT) |
commit | dc2e11ed5a5a8083db1d8b5e2396c9238999568c (patch) | |
tree | 0bfb7c4c7a2cdc7e1f8ee45ceab7dc7c361765e1 | |
parent | 7a6178a7cd8514911e9480f826838dc789fb8655 (diff) | |
download | cpython-dc2e11ed5a5a8083db1d8b5e2396c9238999568c.zip cpython-dc2e11ed5a5a8083db1d8b5e2396c9238999568c.tar.gz cpython-dc2e11ed5a5a8083db1d8b5e2396c9238999568c.tar.bz2 |
[3.9] bpo-41082: Add note on errors that may be raised by home() and expanduser() (GH-28186)
Co-authored-by: Ćukasz Langa <lukasz@langa.pl>
-rw-r--r-- | Doc/library/pathlib.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index c31ff65..88e8756 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -708,6 +708,10 @@ call fails (for example because the path doesn't exist). >>> Path.home() PosixPath('/home/antoine') + Note that unlike :func:`os.path.expanduser`, on POSIX systems a + :exc:`KeyError` or :exc:`RuntimeError` will be raised, and on Windows systems a + :exc:`RuntimeError` will be raised if home directory can't be resolved. + .. versionadded:: 3.5 @@ -764,6 +768,10 @@ call fails (for example because the path doesn't exist). >>> p.expanduser() PosixPath('/home/eric/films/Monty Python') + Note that unlike :func:`os.path.expanduser`, on POSIX systems a + :exc:`KeyError` or :exc:`RuntimeError` will be raised, and on Windows systems a + :exc:`RuntimeError` will be raised if home directory can't be resolved. + .. versionadded:: 3.5 |