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.

Title: os.putenv should support bytes arguments on Windows
Type: enhancement Stage: resolved
Components: Windows Versions: Python 3.7, Python 3.6
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2016-09-17 14:43 by eryksun, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
issue_28188_01.patch eryksun, 2016-09-17 14:45 review
Messages (4)
msg276797 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2016-09-17 14:43
This suggestion may be controversial: os.putenv should decode bytes arguments as UTF-8, the new Windows filesystem encoding. Moreover, os.environb should also be implemented. This would be consistent with bytes support in os.spawnve and os.execve.

The controversial aspect, I think, is that this doesn't allow using arbitrary encodings for environment-variable names and values. The statement in the docs that os.environb allows one "to use a different encoding" than the filesystem encoding would have to be modified with a caveat that on wide-character platforms, such as Windows, using the filesystem encoding is mandatory.
msg354498 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-11 21:22
In the meanwhile, the PEP 540 "UTF-8 Mode" has been implemented.
msg354499 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019-10-11 21:22
This issue was referenced from
msg389138 - (view) Author: Eryk Sun (eryksun) * (Python triager) Date: 2021-03-20 02:17
I thought this was a good idea at the time, but a core dev never took up the mantle in over 4 years, and no one else showed interest.
Date User Action Args
2022-04-11 14:58:37adminsetgithub: 72375
2021-03-20 14:32:18vstinnersetnosy: - vstinner
2021-03-20 02:17:03eryksunsetstatus: open -> closed
resolution: rejected
messages: + msg389138

stage: patch review -> resolved
2019-10-11 21:22:50vstinnersetmessages: + msg354499
2019-10-11 21:22:31vstinnersetnosy: + vstinner
messages: + msg354498
2016-09-24 02:40:18steve.dowersetnosy: + paul.moore, tim.golden, zach.ware, steve.dower
components: + Windows
2016-09-17 14:45:14eryksunsetfiles: + issue_28188_01.patch
keywords: + patch
stage: needs patch -> patch review
2016-09-17 14:43:07eryksuncreate