From: Inada Naoki Date: Tue, 27 Apr 2021 03:46:20 +0000 (+0900) Subject: bpo-43651: Fix EncodingWarning in `pydoc`. (GH-25644) X-Git-Tag: v3.10.0b1~142 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9dfefbe3e2dc548ad306870b56cc0cb475aa20a2;p=thirdparty%2FPython%2Fcpython.git bpo-43651: Fix EncodingWarning in `pydoc`. (GH-25644) --- diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 753ea97ba0c2..8eecd66a2c2f 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -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: