bpo-39395: putenv() and unsetenv() always available (GH-18135) · python/cpython@b8d1262 (original) (raw)
`@@ -111,9 +111,9 @@ process and user.
`
111
111
``` to the environment made after this time are not reflected in os.environ
,
`112`
`112`
``` except for changes made by modifying ``os.environ`` directly.
113
113
``
114
``
`` -
If the platform supports the :func:putenv
function, this mapping may be used
``
115
``
`` -
to modify the environment as well as query the environment. :func:putenv
will
``
116
``
`-
be called automatically when the mapping is modified.
`
``
114
`+
This mapping may be used to modify the environment as well as query the
`
``
115
`` +
environment. :func:putenv
will be called automatically when the mapping
``
``
116
`+
is modified.
`
117
117
``
118
118
`` On Unix, keys and values use :func:sys.getfilesystemencoding
and
``
119
119
``` 'surrogateescape'
error handler. Use :data:environb
if you would like
`@@ -130,14 +130,10 @@ process and user.
`
`130`
`130`
` cause memory leaks. Refer to the system documentation for
`
`131`
`131`
`` :c:func:`putenv`.
``
`132`
`132`
``
`133`
``
`` -
If :func:`putenv` is not provided, a modified copy of this mapping may be
``
`134`
``
`-
passed to the appropriate process-creation functions to cause child processes
`
`135`
``
`-
to use a modified environment.
`
`136`
``
`-`
`137`
``
`` -
If the platform supports the :func:`unsetenv` function, you can delete items in
``
`138`
``
`` -
this mapping to unset environment variables. :func:`unsetenv` will be called
``
`139`
``
``` -
automatically when an item is deleted from ``os.environ``, and when
140
``
`` -
one of the :meth:pop
or :meth:clear
methods is called.
``
``
133
`+
You can delete items in this mapping to unset environment variables.
`
``
134
`` +
:func:unsetenv
will be called automatically when an item is deleted from
``
``
135
``os.environ``, and when one of the :meth:`pop` or :meth:`clear` methods is
``
136
`+
called.
`
141
137
``
142
138
``
143
139
`.. data:: environb
`
`@@ -439,17 +435,18 @@ process and user.
`
439
435
`` changes to the environment affect subprocesses started with :func:os.system
,
``
440
436
`` :func:popen
or :func:fork
and :func:execv
.
``
441
437
``
442
``
`-
.. availability:: most flavors of Unix, Windows.
`
``
438
Assignments to items in ``os.environ`` are automatically translated into
``
439
`` +
corresponding calls to :func:putenv
; however, calls to :func:putenv
``
``
440
don't update ``os.environ``, so it is actually preferable to assign to items
``
441
of ``os.environ``.
443
442
``
444
443
` .. note::
`
445
444
``
446
445
``` On some platforms, including FreeBSD and Mac OS X, setting environ
may
`447`
``
`-
cause memory leaks. Refer to the system documentation for putenv.
`
``
`446`
`` +
cause memory leaks. Refer to the system documentation for :c:func:`putenv`.
``
`448`
`447`
``
`449`
``
``` -
When :func:`putenv` is supported, assignments to items in ``os.environ`` are
450
``
`` -
automatically translated into corresponding calls to :func:putenv
; however,
``
451
``
calls to :func:`putenv` don't update ``os.environ``, so it is actually
452
``
preferable to assign to items of ``os.environ``.
``
448
`+
.. versionchanged:: 3.9
`
``
449
`+
The function is now always available.
`
453
450
``
454
451
``
455
452
`.. function:: setegid(egid)
`
`@@ -638,15 +635,13 @@ process and user.
`
638
635
`` environment affect subprocesses started with :func:os.system
, :func:popen
or
``
639
636
`` :func:fork
and :func:execv
.
``
640
637
``
641
``
When :func:`unsetenv` is supported, deletion of items in ``os.environ`` is
642
``
`` -
automatically translated into a corresponding call to :func:unsetenv
; however,
``
643
``
calls to :func:`unsetenv` don't update ``os.environ``, so it is actually
644
``
preferable to delete items of ``os.environ``.
645
``
-
646
``
`-
.. availability:: most flavors of Unix, Windows.
`
``
638
Deletion of items in ``os.environ`` is automatically translated into a
``
639
`` +
corresponding call to :func:unsetenv
; however, calls to :func:unsetenv
``
``
640
don't update ``os.environ``, so it is actually preferable to delete items of
``
641
``os.environ``.
647
642
``
648
643
` .. versionchanged:: 3.9
`
649
``
`-
The function is now also available on Windows.
`
``
644
`+
The function is now always available and is also available on Windows.
`
650
645
``
651
646
``
652
647
`.. _os-newstreams:
`