[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>
This commit is contained in:
andrei kulakov 2021-09-08 13:24:09 -04:00 committed by GitHub
parent 7a6178a7cd
commit dc2e11ed5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View 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