D8347: encoding: use special dictionary type for env variables on Windows
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
Environment variables on Windows are case insensitive and Python
internally uses a special dict type that normalizes all keys to
Our custom bytes-based environment variable dict on Windows was
not aware of this, leading to failures when looking up lower case
environment variables (such as `http_proxy`).
This commit introduces a custom dict type that normalizes keys
to uppercase on Windows. test-http-proxy.t passes after this
change, as a lookup of b'http_proxy' now succeeds.
It's worth noting that Python's behavior with regards to
normalizing all environment variables to uppercase is buggy.
See https://bugs.python.org/issue28824. I preserved Python's
behavior for compatibility.