classification
Title: Path.home() should ignore HOME env var like os.path.expanduser()
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.9, Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Anthony Sottile, BTaskaya, brett.cannon, lazka, miss-islington, steve.dower
Priority: normal Keywords: patch

Created on 2019-11-21 18:45 by lazka, last changed 2020-01-28 09:59 by miss-islington. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 17961 merged lazka, 2020-01-12 09:23
PR 18229 merged miss-islington, 2020-01-28 09:42
Messages (4)
msg357196 - (view) Author: Christoph Reiter (lazka) * Date: 2019-11-21 18:45
In issue36264 os.path.expanduser() was changed to no longer use the HOME environment variable on Windows.

There are two more ways in the stdlib to get the user directory, pathlib.Path.home() and pathlib.Path.expanduser() which internally use gethomedir() which still uses the HOME environment variable:

https://github.com/python/cpython/blob/0aca3a3a1e68b4ca2d334ab5255dfc267719096e/Lib/pathlib.py#L255

Since they are documented to work the same as os.path.expanduser() they should be changed to no longer use HOME as well.
msg360847 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-01-28 09:42
New changeset c45a2aa9e255b5c7c211faa79f6b23895b64ab27 by Steve Dower (Christoph Reiter) in branch 'master':
bpo-38883: Don't use POSIX `$HOME` in `pathlib.Path.home/expanduser` on Windows (GH-17961)
https://github.com/python/cpython/commit/c45a2aa9e255b5c7c211faa79f6b23895b64ab27
msg360852 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-01-28 09:59
Thanks, Christoph!
msg360854 - (view) Author: miss-islington (miss-islington) Date: 2020-01-28 09:59
New changeset 595b516965ee88b817dc1b3d7713e1f3f263634d by Miss Islington (bot) in branch '3.8':
bpo-38883: Don't use POSIX `$HOME` in `pathlib.Path.home/expanduser` on Windows (GH-17961)
https://github.com/python/cpython/commit/595b516965ee88b817dc1b3d7713e1f3f263634d
History
Date User Action Args
2020-01-28 09:59:47miss-islingtonsetnosy: + miss-islington
messages: + msg360854
2020-01-28 09:59:05steve.dowersetstatus: open -> closed
resolution: fixed
messages: + msg360852

stage: patch review -> resolved
2020-01-28 09:42:13miss-islingtonsetpull_requests: + pull_request17608
2020-01-28 09:42:11steve.dowersetmessages: + msg360847
2020-01-12 09:23:37lazkasetkeywords: + patch
stage: patch review
pull_requests: + pull_request17369
2019-11-21 21:00:37brett.cannonsetnosy: + brett.cannon
2019-11-21 18:54:56Anthony Sottilesetnosy: + Anthony Sottile
2019-11-21 18:54:50BTaskayasetversions: + Python 3.8
2019-11-21 18:52:36BTaskayasetnosy: + steve.dower, BTaskaya

versions: + Python 3.9, - Python 3.8
2019-11-21 18:45:12lazkacreate