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.

Author Anthony Sottile
Recipients Anthony Sottile, paul.moore, steve.dower, tim.golden, zach.ware
Date 2019-03-11.16:09:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1552320597.36.0.934790753816.issue36264@roundup.psfhosted.org>
In-reply-to
Content
The current code for `os.path.expanduser` in `ntpath` uses `HOME` in preference to `USERPROFILE` / `HOMEDRIVE\\HOMEPATH`

I can't find any documentation of `HOME` being relevant on windows (only on posix).  For example, wikipedia only mentions `USERPROFILE` / `HOMEDRIVE\\HOMEPATH` options: https://en.wikipedia.org/wiki/Home_directory#Default_home_directory_per_operating_system

Seems to be (one of) the direct causes of a downstream bug for me: https://github.com/pre-commit/pre-commit/issues/960

(msys sets `HOME` to a bogus value if `HOMEDRIVE` is set, then python uses it)

My proposal is to remove these lines and change the `elif` to an `if`:

https://github.com/python/cpython/blob/d9bd8ec2a40ea67bc4248a72943a409ee645ddf3/Lib/ntpath.py#L302-L304
History
Date User Action Args
2019-03-11 16:09:57Anthony Sottilesetrecipients: + Anthony Sottile, paul.moore, tim.golden, zach.ware, steve.dower
2019-03-11 16:09:57Anthony Sottilesetmessageid: <1552320597.36.0.934790753816.issue36264@roundup.psfhosted.org>
2019-03-11 16:09:57Anthony Sottilelinkissue36264 messages
2019-03-11 16:09:57Anthony Sottilecreate