[Python-checkins] [3.9] bpo-41082: Add note on errors that may be raised by home() and expanduser() (GH-28186)
ambv
webhook-mailer at python.org
Wed Sep 8 13:24:18 EDT 2021
https://github.com/python/cpython/commit/dc2e11ed5a5a8083db1d8b5e2396c9238999568c
commit: dc2e11ed5a5a8083db1d8b5e2396c9238999568c
branch: 3.9
author: andrei kulakov <andrei.avk at gmail.com>
committer: ambv <lukasz at langa.pl>
date: 2021-09-08T19:24:09+02:00
summary:
[3.9] bpo-41082: Add note on errors that may be raised by home() and expanduser() (GH-28186)
Co-authored-by: Łukasz Langa <lukasz at langa.pl>
files:
M Doc/library/pathlib.rst
diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst
index c31ff6543aee52..88e8756cf84a53 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
More information about the Python-checkins
mailing list