homepage

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 benrg
Recipients benrg, paul.moore, steve.dower, tim.golden, zach.ware
Date 2022年02月26日.04:19:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645849179.34.0.588618338218.issue46862@roundup.psfhosted.org>
In-reply-to
Content
On Windows, if one writes
 env = os.environ.copy()
 env['http_proxy'] = 'whatever'
or either of the documented equivalents ({**os.environ, ...} or (os.environ | {...})), and passes the resulting environment to subprocess.run or subprocess.Popen, the spawned process may get an environment containing both `HTTP_PROXY` and `http_proxy`. Most Win32 software will see only the first one, which contains the unmodified value from os.environ.
Because os.environ forces all keys to upper case, it's possible to work around this by using only upper case keys in the update, but that behavior of os.environ is nonstandard (issue 46861), and subprocess shouldn't depend on it always being true, nor should end users have to.
Since dicts preserve order, the user's (presumable) intent is preserved in the env argument. I think subprocess should do something like
 env = {k.upper(): (k, v) for k, v in env.items()}
 env = dict(env.values())
to discard duplicate keys, keeping only the rightmost one.
History
Date User Action Args
2022年02月26日 04:19:39benrgsetrecipients: + benrg, paul.moore, tim.golden, zach.ware, steve.dower
2022年02月26日 04:19:39benrgsetmessageid: <1645849179.34.0.588618338218.issue46862@roundup.psfhosted.org>
2022年02月26日 04:19:39benrglinkissue46862 messages
2022年02月26日 04:19:39benrgcreate

AltStyle によって変換されたページ (->オリジナル) /