-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
gh-120057: Add os.reload_environ() function #126268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0a00444
ad10366
118b8c0
fde06e9
ca90336
1b07ef6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,10 +193,6 @@ process and user. | |
to the environment made after this time are not reflected in :data:`os.environ`, | ||
except for changes made by modifying :data:`os.environ` directly. | ||
|
||
The :meth:`!os.environ.refresh` method updates :data:`os.environ` with | ||
changes to the environment made by :func:`os.putenv`, by | ||
:func:`os.unsetenv`, or made outside Python in the same process. | ||
|
||
This mapping may be used to modify the environment as well as query the | ||
environment. :func:`putenv` will be called automatically when the mapping | ||
is modified. | ||
|
@@ -229,9 +225,6 @@ process and user. | |
.. versionchanged:: 3.9 | ||
Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators. | ||
|
||
.. versionchanged:: 3.14 | ||
Added the :meth:`!os.environ.refresh` method. | ||
|
||
|
||
.. data:: environb | ||
|
||
|
@@ -249,6 +242,15 @@ process and user. | |
Updated to support :pep:`584`'s merge (``|``) and update (``|=``) operators. | ||
|
||
|
||
.. function:: reload_environ() | ||
|
||
Update :data:`os.environ` and :data:`os.environb` with changes to the | ||
environment made by :func:`os.putenv`, by :func:`os.unsetenv`, or made | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 8000 I think that it is better to say "the process environment". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the process environment is mentioned, perhaps it can be specifically mentioned that it is the current process environment (I think) Edit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
outside Python in the same process. | ||
|
||
.. versionadded:: 3.14 | ||
vstinner marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
.. function:: chdir(path) | ||
fchdir(fd) | ||
getcwd() | ||
|
@@ -568,7 +570,7 @@ process and user. | |
of :data:`os.environ`. This also applies to :func:`getenv` and :func:`getenvb`, which | ||
respectively use :data:`os.environ` and :data:`os.environb` in their implementations. | ||
|
||
See also the :data:`os.environ.refresh() <os.environ>` method. | ||
See also the :func:`os.reload_environ` function. | ||
|
||
.. note:: | ||
|
||
|
@@ -818,7 +820,7 @@ process and user. | |
don't update :data:`os.environ`, so it is actually preferable to delete items of | ||
:data:`os.environ`. | ||
|
||
See also the :data:`os.environ.refresh() <os.environ>` method. | ||
See also the :func:`os.reload_environ` function. | ||
|
||
.. audit-event:: os.unsetenv key os.unsetenv | ||
|
||
|
Original file line number | Diff line change | |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Replace the ``os.environ.refresh()`` method with a new | ||
:func:`os.reload_environ` function. Patch by Victor Stinner. |
Uh oh!
There was an error while loading. Please reload this page.