From a0c2e5cefd8e1f60857a7dd6ae1b939d20b29c30 Mon Sep 17 00:00:00 2001 From: andrei kulakov Date: Mon, 6 Sep 2021 13:22:48 -0400 Subject: [PATCH 1/4] Add note on errors that may be raised by home() and expanduser() --- Doc/library/pathlib.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index c31ff6543aee52..37073f1b29e9ba 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` may 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` may be raised, and on Windows systems a :exc:`RuntimeError` + will be raised if home directory can't be resolved. + .. versionadded:: 3.5 From 7557f6da271c36a989b0651308ba9529d30dfdeb Mon Sep 17 00:00:00 2001 From: andrei kulakov Date: Mon, 6 Sep 2021 13:25:02 -0400 Subject: [PATCH 2/4] fix wording --- Doc/library/pathlib.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 37073f1b29e9ba..92c6f1499e50f6 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -709,7 +709,7 @@ call fails (for example because the path doesn't exist). PosixPath('/home/antoine') Note that unlike :func:`os.path.expanduser`, on Posix systems a - :exc:`KeyError` may be raised, and on Windows systems a :exc:`RuntimeError` + :exc:`KeyError` will be raised, and on Windows systems a :exc:`RuntimeError` will be raised if home directory can't be resolved. .. versionadded:: 3.5 @@ -769,7 +769,7 @@ call fails (for example because the path doesn't exist). PosixPath('/home/eric/films/Monty Python') Note that unlike :func:`os.path.expanduser`, on Posix systems a - :exc:`KeyError` may be raised, and on Windows systems a :exc:`RuntimeError` + :exc:`KeyError` will be raised, and on Windows systems a :exc:`RuntimeError` will be raised if home directory can't be resolved. .. versionadded:: 3.5 From bc5e625017369d1ef62a3a6dcd2445ea222233df Mon Sep 17 00:00:00 2001 From: andrei kulakov Date: Mon, 6 Sep 2021 13:31:28 -0400 Subject: [PATCH 3/4] expand note for posix errors --- Doc/library/pathlib.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 92c6f1499e50f6..00f0ac23bb48ef 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -709,8 +709,8 @@ call fails (for example because the path doesn't exist). PosixPath('/home/antoine') Note that unlike :func:`os.path.expanduser`, on Posix systems a - :exc:`KeyError` will be raised, and on Windows systems a :exc:`RuntimeError` - will be raised if home directory can't be resolved. + :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 @@ -769,8 +769,8 @@ call fails (for example because the path doesn't exist). PosixPath('/home/eric/films/Monty Python') Note that unlike :func:`os.path.expanduser`, on Posix systems a - :exc:`KeyError` will be raised, and on Windows systems a :exc:`RuntimeError` - will be raised if home directory can't be resolved. + :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 From 22ecea922b4a97a37b2e1dae6601da1e2376616a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Langa?= Date: Wed, 8 Sep 2021 18:56:09 +0200 Subject: [PATCH 4/4] s/Posix/POSIX/ --- Doc/library/pathlib.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/pathlib.rst b/Doc/library/pathlib.rst index 00f0ac23bb48ef..88e8756cf84a53 100644 --- a/Doc/library/pathlib.rst +++ b/Doc/library/pathlib.rst @@ -708,7 +708,7 @@ 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 + 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. @@ -768,7 +768,7 @@ 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 + 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.