This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: os.getlogin() should recommend getpass.getuser()
Type: Stage: resolved
Components: Documentation Versions: Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: barry Nosy List: barry
Priority: normal Keywords: patch

Created on 2018-01-24 15:37 by barry, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5301 merged barry, 2018-01-24 15:47
PR 5304 merged python-dev, 2018-01-24 17:52
Messages (3)
msg310601 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2018-01-24 15:37
The documentation for os.getlogin() says:

"Return the name of the user logged in on the controlling terminal of the process. For most purposes, it is more useful to use the environment variables LOGNAME or USERNAME to find out who the user is, or pwd.getpwuid(os.getuid())[0] to get the login name of the current real user id.

Availability: Unix, Windows."

Well, why not suggestion getpass.getuser() since that's exactly how the latter works? :)
msg310621 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2018-01-24 17:51
New changeset d499031f5f33c3ef71be7c81ef52eee6b47c42e1 by Barry Warsaw in branch 'master':
bpo-32651 Recommend getpass.getuser() (#5301)
https://github.com/python/cpython/commit/d499031f5f33c3ef71be7c81ef52eee6b47c42e1
msg310623 - (view) Author: Barry A. Warsaw (barry) * (Python committer) Date: 2018-01-24 19:09
New changeset 196b8cbab2b5044b92077f0b3c07c798fff68bc6 by Barry Warsaw (Miss Islington (bot)) in branch '3.6':
bpo-32651 Recommend getpass.getuser() (GH-5301) (#5304)
https://github.com/python/cpython/commit/196b8cbab2b5044b92077f0b3c07c798fff68bc6
History
Date User Action Args
2022-04-11 14:58:57adminsetgithub: 76832
2018-01-24 19:10:16barrysetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: + Python 3.6
2018-01-24 19:09:59barrysetmessages: + msg310623
2018-01-24 17:52:42python-devsetpull_requests: + pull_request5151
2018-01-24 17:51:31barrysetmessages: + msg310621
2018-01-24 15:47:14barrysetkeywords: + patch
stage: patch review
pull_requests: + pull_request5148
2018-01-24 15:37:19barrycreate