[Python-checkins] cpython (merge 3.4 -> default): Merge: #23792: also catch interrupt around pipe.write.
r.david.murray
python-checkins at python.org
Mon Mar 30 16:17:59 CEST 2015
https://hg.python.org/cpython/rev/536c4f4acae1
changeset: 95299:536c4f4acae1
parent: 95297:00c982c9f681
parent: 95298:7a5f30babc72
user: R David Murray <rdmurray at bitdance.com>
date: Mon Mar 30 10:15:22 2015 -0400
summary:
Merge: #23792: also catch interrupt around pipe.write.
files:
Lib/pydoc.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1451,7 +1451,12 @@
proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE)
try:
with io.TextIOWrapper(proc.stdin, errors='backslashreplace') as pipe:
- pipe.write(text)
+ try:
+ pipe.write(text)
+ except KeyboardInterrupt:
+ # We've hereby abandoned whatever text hasn't been written,
+ # but the pager is still in control of the terminal.
+ pass
except OSError:
pass # Ignore broken pipes caused by quitting the pager program.
while True:
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list