From f7252ce86426b10f13f0261987ec519d0d779b00 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 27 Apr 2021 10:50:09 +0900 Subject: [PATCH 1/2] bpo-43651: Fix EncodingWarning in `pydoc`. --- Lib/pydoc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 753ea97ba0c2a7..0ff89e7d0d29e1 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1594,9 +1594,9 @@ 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: From caf75bb98b5e065905ad5e2c61e609d32f849ee9 Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Tue, 27 Apr 2021 11:09:51 +0900 Subject: [PATCH 2/2] wrap long line --- Lib/pydoc.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 0ff89e7d0d29e1..8eecd66a2c2fbf 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -1594,7 +1594,8 @@ 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, errors='backslashreplace') + proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, + errors='backslashreplace') try: with proc.stdin as pipe: try: