New submission from Anthony Sottile <asott...@umich.edu>:
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 ---------- components: Library (Lib), Windows messages: 337683 nosy: Anthony Sottile, paul.moore, steve.dower, tim.golden, zach.ware priority: normal severity: normal status: open title: os.path.expanduser should not use HOME on windows type: behavior versions: Python 3.8 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36264> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com