[Python-checkins] bpo-44572: On Windows, disconnect STDIN in platform._syscmd_ver() to prevent erroneous STDIN consumption (GH-27092) (GH-27124)

pablogsal webhook-mailer at python.org
Tue Jul 13 15:48:33 EDT 2021


https://github.com/python/cpython/commit/425756abdc03263ab3a52b068befd1ddb16c2dd2
commit: 425756abdc03263ab3a52b068befd1ddb16c2dd2
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: pablogsal <Pablogsal at gmail.com>
date: 2021-07-13T20:48:23+01:00
summary:

bpo-44572: On Windows, disconnect STDIN in platform._syscmd_ver() to prevent erroneous STDIN consumption (GH-27092) (GH-27124)

(cherry picked from commit 0ee0a740e12ec8568aafa033aa6bb08b265afe26)

Co-authored-by: Konstantin-Glukhov <glukhov.k at gmail.com>

files:
A Misc/NEWS.d/next/Windows/2021-07-13-15-32-49.bpo-44572.gXvhDc.rst
M Lib/platform.py

diff --git a/Lib/platform.py b/Lib/platform.py
index d298a42edc848..134fbae6b1cc7 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -280,6 +280,7 @@ def _syscmd_ver(system='', release='', version='',
     for cmd in ('ver', 'command /c ver', 'cmd /c ver'):
         try:
             info = subprocess.check_output(cmd,
+                                           stdin=subprocess.DEVNULL,
                                            stderr=subprocess.DEVNULL,
                                            text=True,
                                            shell=True)
diff --git a/Misc/NEWS.d/next/Windows/2021-07-13-15-32-49.bpo-44572.gXvhDc.rst b/Misc/NEWS.d/next/Windows/2021-07-13-15-32-49.bpo-44572.gXvhDc.rst
new file mode 100644
index 0000000000000..6e074c59b8445
--- /dev/null
+++ b/Misc/NEWS.d/next/Windows/2021-07-13-15-32-49.bpo-44572.gXvhDc.rst
@@ -0,0 +1 @@
+Avoid consuming standard input in the :mod:`platform` module
\ No newline at end of file



More information about the Python-checkins mailing list