diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2020-01-28 10:41:50 +0100 |
---|---|---|
committer | Steve Dower <steve.dower@python.org> | 2020-01-28 20:41:50 +1100 |
commit | c45a2aa9e255b5c7c211faa79f6b23895b64ab27 (patch) | |
tree | 05b12f49c1133fc3713d23eb51eb5ed770b9424f /Lib/pathlib.py | |
parent | 61f4db8c56ca4b7e60050d96ecc255cfb03d92a0 (diff) | |
download | cpython-git-c45a2aa9e255b5c7c211faa79f6b23895b64ab27.tar.gz |
bpo-38883: Don't use POSIX `$HOME` in `pathlib.Path.home/expanduser` on Windows (GH-17961)
In bpo-36264 os.path.expanduser was changed to ignore HOME on Windows.
Path.expanduser/home still honored HOME despite being documented as behaving the same
as os.path.expanduser. This makes them also ignore HOME so that both implementations
behave the same way again.
Diffstat (limited to 'Lib/pathlib.py')
-rw-r--r-- | Lib/pathlib.py | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/pathlib.py b/Lib/pathlib.py index 7d1d1150b0..a5f3313902 100644 --- a/Lib/pathlib.py +++ b/Lib/pathlib.py @@ -253,9 +253,7 @@ class _WindowsFlavour(_Flavour): return 'file:' + urlquote_from_bytes(path.as_posix().encode('utf-8')) def gethomedir(self, username): - if 'HOME' in os.environ: - userhome = os.environ['HOME'] - elif 'USERPROFILE' in os.environ: + if 'USERPROFILE' in os.environ: userhome = os.environ['USERPROFILE'] elif 'HOMEPATH' in os.environ: try: |