bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890) · python/cpython@cef0a54

GitHub

Original file line numberDiff line numberDiff line change@@ -731,9 +731,12 @@ def collect_windows(info_add):

731731732732importsubprocess

733733try:

734+# When wmic.exe output is redirected to a pipe,

735+# it uses the OEM code page

734736proc=subprocess.Popen(["wmic", "os", "get", "Caption,Version", "/value"],

735737stdout=subprocess.PIPE,

736738stderr=subprocess.PIPE,

739+encoding="oem",

737740text=True)

738741output, stderr=proc.communicate()

739742ifproc.returncode: