]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (GH-30890)
authorVictor Stinner <vstinner@python.org>
Tue, 25 Jan 2022 19:02:23 +0000 (20:02 +0100)
committerGitHub <noreply@github.com>
Tue, 25 Jan 2022 19:02:23 +0000 (20:02 +0100)
Lib/test/pythoninfo.py

index cfd7ac2755d519972538302fb36779abb9207bfb..d15a11c80b649af4890bcc1afe472ecb6b981f57 100644 (file)
@@ -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: