8000 gh-101754: document that on Windows, keys in `os.environ` are converted to uppercase by OTheDev · Pull Request #101840 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-101754: document that on Windows, keys in os.environ are converted to uppercase #101840

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

Merged
merged 2 commits into from
Mar 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Address review and move note below 'On Unix'
  • Loading branch information
OTheDev committed Mar 3, 2023
commit 19f0c6ba1d6127c3781190da1b89bc2fadd65c25
12 changes: 5 additions & 7 deletions Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ process and user.
``'surrogateescape'`` error handler. Use :data:`environb` if you would like
to use a different encoding.

On Windows, the keys are converted to uppercase. This also applies when
getting, setting, or deleting an item. For example,
``environ['monty'] = 'python'`` maps the key ``'MONTY'`` to the value
``'python'``.

.. note::

Calling :func:`putenv` directly does not change :data:`os.environ`, so it's better
Expand All @@ -212,13 +217,6 @@ process and user.
cause memory leaks. Refer to the system documentation for
:c:func:`putenv`.

.. note::

On Windows, the keys are converted to uppercase. This also applies when
getting, setting, or deleting an item. For example,
``environ['monty'] = 'python'`` maps the key ``'MONTY'`` to the value
``'python'``.

You can delete items in this mapping to unset environment variables.
:func:`unsetenv` will be called automatically when an item is deleted from
:data:`os.environ`, and when one of the :meth:`pop` or :meth:`clear` methods is
Expand Down
0