]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43651: Fix EncodingWarning in `pydoc`. (GH-25644)
authorInada Naoki <songofacandy@gmail.com>
Tue, 27 Apr 2021 03:46:20 +0000 (12:46 +0900)
committerGitHub <noreply@github.com>
Tue, 27 Apr 2021 03:46:20 +0000 (12:46 +0900)
Lib/pydoc.py

index 753ea97ba0c2a77b917b2f7ed387f42c8c8fb40d..8eecd66a2c2fbf3c2e910868dc0cfac265c383e0 100755 (executable)
@@ -1594,9 +1594,10 @@ def plain(text):
 def pipepager(text, cmd):
     """Page through text by feeding it to another program."""
     import subprocess
-    proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE)
+    proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
+                            errors='backslashreplace')
     try:
-        with io.TextIOWrapper(proc.stdin, errors='backslashreplace') as pipe:
+        with proc.stdin as pipe:
             try:
                 pipe.write(text)
             except KeyboardInterrupt: