]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.9] bpo-41082: Add note on errors that may be raised by home() and expanduser(...
authorandrei kulakov <andrei.avk@gmail.com>
Wed, 8 Sep 2021 17:24:09 +0000 (13:24 -0400)
committerGitHub <noreply@github.com>
Wed, 8 Sep 2021 17:24:09 +0000 (19:24 +0200)
Co-authored-by: Ɓukasz Langa <lukasz@langa.pl>
Doc/library/pathlib.rst

index c31ff6543aee52cd38f8c4286e0b37dc6c4dae1a..88e8756cf84a53a9af5aad903f44de0a714d55af 100644 (file)
@@ -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