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. |