summaryrefslogtreecommitdiffstats
path: root/Lib/platform.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2021-12-02 09:17:37 (GMT)
committerGitHub <noreply@github.com>2021-12-02 09:17:37 (GMT)
commitcb2b3c8d3566ae46b3b8d0718019e1c98484589e (patch)
tree85280eaa01fe4a7f6ce5fa8e1559ed71377154a9 /Lib/platform.py
parent226d22ff2d209495621550eb78e81ed4c0fe0152 (diff)
downloadcpython-cb2b3c8d3566ae46b3b8d0718019e1c98484589e.zip
cpython-cb2b3c8d3566ae46b3b8d0718019e1c98484589e.tar.gz
cpython-cb2b3c8d3566ae46b3b8d0718019e1c98484589e.tar.bz2
bpo-40280: Emscripten has no support for subprocesses (GH-29872)
Fixes ``platform`` and ``help()`` on emscripten. Signed-off-by: Christian Heimes <christian@python.org> Automerge-Triggered-By: GH:tiran
Diffstat (limited to 'Lib/platform.py')
-rwxr-xr-xLib/platform.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/platform.py b/Lib/platform.py
index 9e9b422..3f3f25a 100755
--- a/Lib/platform.py
+++ b/Lib/platform.py
@@ -607,7 +607,10 @@ def _syscmd_file(target, default=''):
# XXX Others too ?
return default
- import subprocess
+ try:
+ import subprocess
+ except ImportError:
+ return default
target = _follow_symlinks(target)
# "file" output is locale dependent: force the usage of the C locale
# to get deterministic behavior.
@@ -746,7 +749,10 @@ class _Processor:
"""
Fall back to `uname -p`
"""
- import subprocess
+ try:
+ import subprocess
+ except ImportError:
+ return None
try:
return subprocess.check_output(
['uname', '-p'],