From 9dfefbe3e2dc548ad306870b56cc0cb475aa20a2 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 27 Apr 2021 12:46:20 +0900 Subject: bpo-43651: Fix EncodingWarning in `pydoc`. (GH-25644) --- Lib/pydoc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Lib/pydoc.py') diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 753ea97ba0..8eecd66a2c 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: -- cgit v1.2.1