From d4064b688fc7c1cb00030fa5ee3ae6aa257b68e4 Mon Sep 17 00:00:00 2001 From: Andrey Doroschenko Date: Wed, 26 Feb 2020 15:21:36 +0300 Subject: [PATCH 1/2] bpo-39759: Fixed os.getenv documentation --- Doc/library/os.rst | 3 ++- .../Documentation/2020-02-26-15-21-17.bpo-39759.mMDBAl.rst | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Documentation/2020-02-26-15-21-17.bpo-39759.mMDBAl.rst diff --git a/Doc/library/os.rst b/Doc/library/os.rst index af02a373f33dc06..2b3821bb3ee1bdb 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -217,7 +217,8 @@ process and user. .. function:: getenv(key, default=None) Return the value of the environment variable *key* if it exists, or - *default* if it doesn't. *key*, *default* and the result are str. + *default* if it doesn't. Only *key* needs to be a string as it is used to + lookup the value in os.environ. On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding` and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you diff --git a/Misc/NEWS.d/next/Documentation/2020-02-26-15-21-17.bpo-39759.mMDBAl.rst b/Misc/NEWS.d/next/Documentation/2020-02-26-15-21-17.bpo-39759.mMDBAl.rst new file mode 100644 index 000000000000000..c47e836a193a34e --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2020-02-26-15-21-17.bpo-39759.mMDBAl.rst @@ -0,0 +1 @@ +Fixed os.getenv documentation. From 6a1faeeaebb5d2b8480a659b0ace77fa1ca78822 Mon Sep 17 00:00:00 2001 From: Andrey Doroschenko Date: Wed, 26 Feb 2020 15:39:46 +0300 Subject: [PATCH 2/2] bpo-39759: Fix after review --- Doc/library/os.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Doc/library/os.rst b/Doc/library/os.rst index 2b3821bb3ee1bdb..9c983a19a51c600 100644 --- a/Doc/library/os.rst +++ b/Doc/library/os.rst @@ -217,8 +217,7 @@ process and user. .. function:: getenv(key, default=None) Return the value of the environment variable *key* if it exists, or - *default* if it doesn't. Only *key* needs to be a string as it is used to - lookup the value in os.environ. + *default* if it doesn't. *key* must be a string. On Unix, keys and values are decoded with :func:`sys.getfilesystemencoding` and ``'surrogateescape'`` error handler. Use :func:`os.getenvb` if you