[New-bugs-announce] [issue39406] Implement os.putenv() with setenv() if available

STINNER Victor report at bugs.python.org
Tue Jan 21 03:30:02 EST 2020

New submission from STINNER Victor <vstinner at python.org>:

Currently, os.putenv() is always implemented with putenv(). The problem is that putenv(str) puts directly the string into the environment, the string is not copied. So Python has to keep track of this memory.

In Python 3.9, this string is now cleared at Python exit, without unsetting the environment variable which cause bpo-39395 crash.

I propose to implement os.putenv() with setenv() if available, which avoids bpo-39395 on platforms providing setenv().

components: Library (Lib)
messages: 360365
nosy: vstinner
priority: normal
severity: normal
status: open
title: Implement os.putenv() with setenv() if available
versions: Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list