From: andrei kulakov Date: Wed, 8 Sep 2021 17:24:09 +0000 (-0400) Subject: [3.9] bpo-41082: Add note on errors that may be raised by home() and expanduser(... X-Git-Tag: v3.9.8~179 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc2e11ed5a5a8083db1d8b5e2396c9238999568c;p=thirdparty%2FPython%2Fcpython.git [3.9] bpo-41082: Add note on errors that may be raised by home() and expanduser() (GH-28186) Co-authored-by: Ɓukasz Langa --- diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index c31ff6543aee..88e8756cf84a 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