summaryrefslogtreecommitdiffstats
path: root/Doc/library/getpass.rst
diff options
context:
space:
mode:
authorJacob Walls <jacobtylerwalls@gmail.com>2023-11-27 18:05:55 (GMT)
committerGitHub <noreply@github.com>2023-11-27 18:05:55 (GMT)
commit99a73c3465a45fe57cac01a917fc50e0743b5964 (patch)
treebe3c8979398f0e81a6e9d5bccb7b3d715f1cb418 /Doc/library/getpass.rst
parent936c503a442ee062c837e334f237796554c792ff (diff)
downloadcpython-99a73c3465a45fe57cac01a917fc50e0743b5964.zip
cpython-99a73c3465a45fe57cac01a917fc50e0743b5964.tar.gz
cpython-99a73c3465a45fe57cac01a917fc50e0743b5964.tar.bz2
gh-76912: Raise OSError from any failure in getpass.getuser() (#29739)
* bpo-32731: Raise OSError from any failure in getpass.getuser() Previously, if the username was not set in certain environment variables, ImportError escaped on Windows systems, and it was possible for KeyError to escape on other systems if getpwuid() failed.
Diffstat (limited to 'Doc/library/getpass.rst')
-rw-r--r--Doc/library/getpass.rst7
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/library/getpass.rst b/Doc/library/getpass.rst
index 5c79daf..54c84d4 100644
--- a/Doc/library/getpass.rst
+++ b/Doc/library/getpass.rst
@@ -46,7 +46,10 @@ The :mod:`getpass` module provides two functions:
:envvar:`USER`, :envvar:`!LNAME` and :envvar:`USERNAME`, in order, and
returns the value of the first one which is set to a non-empty string. If
none are set, the login name from the password database is returned on
- systems which support the :mod:`pwd` module, otherwise, an exception is
- raised.
+ systems which support the :mod:`pwd` module, otherwise, an :exc:`OSError`
+ is raised.
In general, this function should be preferred over :func:`os.getlogin()`.
+
+ .. versionchanged:: 3.13
+ Previously, various exceptions beyond just :exc:`OSError` were raised.