mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
bpo-43651: Fix EncodingWarning in pydoc
. (GH-25644)
This commit is contained in:
parent
284c52da09
commit
9dfefbe3e2
1 changed files with 3 additions and 2 deletions
|
@ -1594,9 +1594,10 @@ def plain(text):
|
||||||
def pipepager(text, cmd):
|
def pipepager(text, cmd):
|
||||||
"""Page through text by feeding it to another program."""
|
"""Page through text by feeding it to another program."""
|
||||||
import subprocess
|
import subprocess
|
||||||
proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE)
|
proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE,
|
||||||
|
errors='backslashreplace')
|
||||||
try:
|
try:
|
||||||
with io.TextIOWrapper(proc.stdin, errors='backslashreplace') as pipe:
|
with proc.stdin as pipe:
|
||||||
try:
|
try:
|
||||||
pipe.write(text)
|
pipe.write(text)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue