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 jaraco
Recipients Anthony Sottile, blueyed, eryksun, jaraco, lazka, miss-islington, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-05-16.13:30:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> Platform differences can be papered over with functions.

I’m not suggesting that from within Python there should be another way to detect a home directory. The expanduser functionality as written is just fine for that, though I agree with Steve that using an API on Windows would be even better.

The issue is that from outside Python there’s now no platform-agnostic way to override the home directory, either for tests or to suppress user-local configuration. In addition to the test case, there is a user-facing use-case that's made more complicated:

- A user needs to bypass the logged-in user's state for a Python command. For example, there was a buggy release (of something) that stored some broken state in the users’ home dir, and the workaround is to run some command with an alternate home dir. Communicating that technique to a multi-platform audience is now much more difficult.

It was previously difficult enough because “set an environment variable” is a shell-dependent operation, so already requires the user to have some expertise on how to set environment variables in their environment.

This change requires the guidance to be more complicated or for the expertise to be greater.

> Breakage due to HOME being overridden is serious because it won't show up in any other cases - Python will be the first to suffer the consequences

Evidence is to the contrary.

It seems other tools like 'git' honor the HOME directory:

PS C:\Users\jaraco> $env:HOME = "C:\Users\jaraco\temp"
PS C:\Users\jaraco> git config --global --list
fatal: unable to read config file 'C:/Users/jaraco/temp/.gitconfig': No such file or directory

Interestingly, I notice that Powershell does set the $HOME environment variable on Windows, reinforcing the concept that $HOME is a platform agnostic way to communicate a home directory.

It does appear as if [Ruby honors HOME and sets it if unset on Windows]( I'm not a fan of setting the variable, but there is precedent.

It seems to me Python 3.8 is the outlier and that honoring $HOME, while somewhat awkward on Windows, was a valuable unifying behavior, and its removal without any plans for a replacement is causing harm. Just searching through some of the projects I have checked out, I find a few.

Here's [another real-world example relying on Python honoring HOME to override home](

[Until recently](, PDB used to look exclusively at $HOME and [the backport still does](

Devpi client [relies on setting home for tests](

> we are facing a targeted exploit.

What is the exploit? I don't think the downsides of honoring HOME on Windows were captured above.

From what I could tell, there was one (fairly obscure) case where HOME was set unexpectedly. That hardly seems like a justification to reverse a long-standing documented feature that aligns with the expectation of other tools in the ecosystem.
Date User Action Args
2020-05-16 13:30:49jaracosetrecipients: + jaraco, paul.moore, blueyed, tim.golden, zach.ware, eryksun, steve.dower, lazka, Anthony Sottile, miss-islington
2020-05-16 13:30:49jaracosetmessageid: <>
2020-05-16 13:30:49jaracolinkissue36264 messages
2020-05-16 13:30:48jaracocreate