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 gregory.p.smith
Recipients gregory.p.smith
Date 2020-01-18.00:47:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
For more context, see which seeks to document the existing caveats.

POSIX lacks any APIs to access the process global environment in a thread safe manner.  Given this, we could _consider_ preventing os.putenv() and os.environ[x] = y assignment from actually modifying the process global environment.  They'd save their changes in our local os.environ underlying dict, set a flag that it was modified, but not modify the global.

This would be a visible behavior change and break _some_ class of code. :/

Our stdlib codepaths that launch a new process on POSIX could be modified to to always pass our a newly constructed envp from os.environ to exec/spawn APIs.  The os.system() API would need to stop using the POSIX system() API call in order for that to work.

Downside API breakage: Extension module modifications to the environment would not be picked up by Python interpreter launched subprocesses.  How much of a problem would that be in practice?

We may decide to close this as infeasible and just stick with the documentation of the sorry state of POSIX and not attempt to offer any safe non-crash-possible workarounds.
Date User Action Args
2020-01-18 00:47:44gregory.p.smithsetrecipients: + gregory.p.smith
2020-01-18 00:47:44gregory.p.smithsetmessageid: <>
2020-01-18 00:47:44gregory.p.smithlinkissue39376 messages
2020-01-18 00:47:43gregory.p.smithcreate