From 1bed00f2371a7a76aa293e5b3bb381fd507b2590 Mon Sep 17 00:00:00 2001 From: oda-gitso Date: Sun, 12 Feb 2023 11:59:53 +0700 Subject: [PATCH 1/2] fix-issue-101754 --- Doc/library/os.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index fb091176767f7a..a358b9137c9367 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -212,6 +212,13 @@ 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 From 19f0c6ba1d6127c3781190da1b89bc2fadd65c25 Mon Sep 17 00:00:00 2001 From: Owain Davies Date: Fri, 3 Mar 2023 14:54:14 +0700 Subject: [PATCH 2/2] Address review and move note below 'On Unix' --- Doc/library/os.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index a358b9137c9367..58b434837a3375 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -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 @@ -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