[Python-checkins] bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890)
vstinner
webhook-mailer at python.org
Tue Jan 25 14:02:32 EST 2022
https://github.com/python/cpython/commit/cef0a5458f254c2f8536b928dee25862ca90ffa6
commit: cef0a5458f254c2f8536b928dee25862ca90ffa6
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-01-25T20:02:23+01:00
summary:
bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890)
files:
M Lib/test/pythoninfo.py
diff --git a/Lib/test/pythoninfo.py b/Lib/test/pythoninfo.py
index cfd7ac2755d51..d15a11c80b649 100644
--- a/Lib/test/pythoninfo.py
+++ b/Lib/test/pythoninfo.py
@@ -731,9 +731,12 @@ def collect_windows(info_add):
import subprocess
try:
+ # When wmic.exe output is redirected to a pipe,
+ # it uses the OEM code page
proc = subprocess.Popen(["wmic", "os", "get", "Caption,Version", "/value"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
+ encoding="oem",
text=True)
output, stderr = proc.communicate()
if proc.returncode:
More information about the Python-checkins
mailing list