]> granicus.if.org Git - python/commit
bpo-35346, platform: replace os.popen() with subprocess (GH-10786)
authorVictor Stinner <vstinner@redhat.com>
Fri, 7 Dec 2018 10:10:33 +0000 (11:10 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Dec 2018 10:10:33 +0000 (11:10 +0100)
commit3a521f0b6167628f975c773b56c7daf8d33d6f40
tree91f83d86bd25493d1285fbca6fccc2280c5ebfc0
parent9ebe8794f003dadfff578a066ea503a3e37ffe1d
bpo-35346, platform: replace os.popen() with subprocess (GH-10786)

Replace os.popen() with subprocess.check_output() in the platform module:

* platform.uname() (its _syscmd_ver() helper function) now redirects
  stderr to DEVNULL.
* Remove platform.DEV_NULL.
* _syscmd_uname() and _syscmd_file() no longer catch AttributeError.
  The "except AttributeError:" was only needed in Python 2, when
  os.popen() was not always available. In Python 3,
  subprocess.check_output() is always available.
Lib/platform.py
Lib/test/test_platform.py
Misc/NEWS.d/next/Library/2018-11-29-12-42-13.bpo-35346.OmTY5c.rst [new file with mode: 0644]