[Python-checkins] bpo-40280: Emscripten has no support for subprocesses (GH-29872)

miss-islington webhook-mailer at python.org
Thu Dec 2 04:17:47 EST 2021


https://github.com/python/cpython/commit/cb2b3c8d3566ae46b3b8d0718019e1c98484589e
commit: cb2b3c8d3566ae46b3b8d0718019e1c98484589e
branch: main
author: Christian Heimes <christian at python.org>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-12-02T01:17:37-08:00
summary:

bpo-40280: Emscripten has no support for subprocesses (GH-29872)



Fixes ``platform`` and ``help()`` on emscripten.

Signed-off-by: Christian Heimes <christian at python.org>

Automerge-Triggered-By: GH:tiran

files:
M Lib/platform.py
M Lib/pydoc.py

diff --git a/Lib/platform.py b/Lib/platform.py
index 9e9b42238fb76..3f3f25a2c92d3 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 @@ def from_subprocess():
         """
         Fall back to `uname -p`
         """
-        import subprocess
+        try:
+            import subprocess
+        except ImportError:
+            return None
         try:
             return subprocess.check_output(
                 ['uname', '-p'],
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 3a2ff218f8319..7d52359c9a0ce 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1556,6 +1556,8 @@ def getpager():
         return plainpager
     if not sys.stdin.isatty() or not sys.stdout.isatty():
         return plainpager
+    if sys.platform == "emscripten":
+        return plainpager
     use_pager = os.environ.get('MANPAGER') or os.environ.get('PAGER')
     if use_pager:
         if sys.platform == 'win32': # pipes completely broken in Windows



More information about the Python-checkins mailing list