Skip to content

Commit dc2e11e

Browse files
akulakovambv
andauthored
[3.9] bpo-41082: Add note on errors that may be raised by home() and expanduser() (GH-28186)
Co-authored-by: Łukasz Langa <[email protected]>
1 parent 7a6178a commit dc2e11e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Doc/library/pathlib.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,6 +708,10 @@ call fails (for example because the path doesn't exist).
708708
>>> Path.home()
709709
PosixPath('/home/antoine')
710710

711+
Note that unlike :func:`os.path.expanduser`, on POSIX systems a
712+
:exc:`KeyError` or :exc:`RuntimeError` will be raised, and on Windows systems a
713+
:exc:`RuntimeError` will be raised if home directory can't be resolved.
714+
711715
.. versionadded:: 3.5
712716

713717

@@ -764,6 +768,10 @@ call fails (for example because the path doesn't exist).
764768
>>> p.expanduser()
765769
PosixPath('/home/eric/films/Monty Python')
766770

771+
Note that unlike :func:`os.path.expanduser`, on POSIX systems a
772+
:exc:`KeyError` or :exc:`RuntimeError` will be raised, and on Windows systems a
773+
:exc:`RuntimeError` will be raised if home directory can't be resolved.
774+
767775
.. versionadded:: 3.5
768776

769777

0 commit comments

Comments
 (0)