From baff8289099d8019496e6a2608b1a90035c18cad Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Fri, 20 Jan 2023 22:25:38 +0000 Subject: [PATCH] gh-100750: pass encoding kwarg in lib/platform.py (GH-100751) (cherry picked from commit 6b3993c556eb3bb36d1754a17643cddd3f6ade92) Co-authored-by: Thomas Grainger Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> --- Lib/platform.py | 2 ++ .../next/Library/2023-01-04-14-42-59.gh-issue-100750.iFJs5Y.rst | 1 + 2 files changed, 3 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2023-01-04-14-42-59.gh-issue-100750.iFJs5Y.rst diff --git a/Lib/platform.py b/Lib/platform.py index 6a820c90a1ae42..92c9766d74fca0 100755 --- a/Lib/platform.py +++ b/Lib/platform.py @@ -283,6 +283,7 @@ def _syscmd_ver(system='', release='', version='', stdin=subprocess.DEVNULL, stderr=subprocess.DEVNULL, text=True, + encoding="locale", shell=True) except (OSError, subprocess.CalledProcessError) as why: #print('Command %s failed: %s' % (cmd, why)) @@ -753,6 +754,7 @@ def from_subprocess(): ['uname', '-p'], stderr=subprocess.DEVNULL, text=True, + encoding="utf8", ).strip() except (OSError, subprocess.CalledProcessError): pass diff --git a/Misc/NEWS.d/next/Library/2023-01-04-14-42-59.gh-issue-100750.iFJs5Y.rst b/Misc/NEWS.d/next/Library/2023-01-04-14-42-59.gh-issue-100750.iFJs5Y.rst new file mode 100644 index 00000000000000..be351532822c4b --- /dev/null +++ b/Misc/NEWS.d/next/Library/2023-01-04-14-42-59.gh-issue-100750.iFJs5Y.rst @@ -0,0 +1 @@ +pass encoding kwarg to subprocess in platform