Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eac2194

Browse files
committed
merge 3.4 (#11709)
2 parents 10e847b + 159824e commit eac2194

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

Lib/pydoc.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,6 +1415,8 @@ def pager(text):
14151415

14161416
def getpager():
14171417
"""Decide what method to use for paging through text."""
1418+
if not hasattr(sys.stdin, "isatty"):
1419+
return plainpager
14181420
if not hasattr(sys.stdout, "isatty"):
14191421
return plainpager
14201422
if not sys.stdin.isatty() or not sys.stdout.isatty():

Lib/test/test_pydoc.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,14 @@ def test_issue8225(self):
446446
result, doc_loc = get_pydoc_text(xml.etree)
447447
self.assertEqual(doc_loc, "", "MODULE DOCS incorrectly includes a link")
448448

449+
def test_getpager_with_stdin_none(self):
450+
previous_stdin = sys.stdin
451+
try:
452+
sys.stdin = None
453+
pydoc.getpager() # Shouldn't fail.
454+
finally:
455+
sys.stdin = previous_stdin
456+
449457
def test_non_str_name(self):
450458
# issue14638
451459
# Treat illegal (non-str) name like no name

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ Library
9494

9595
- Issue #20578: Add io.BufferedIOBase.readinto1.
9696

97+
- Issue #11709: Fix the pydoc.help function to not fail when sys.stdin is not a
98+
valid file.
99+
97100
- Issue #21515: tempfile.TemporaryFile now uses os.O_TMPFILE flag is available.
98101

99102
- Issue #13223: Fix pydoc.writedoc so that the HTML documentation for methods

0 commit comments

Comments
 (0)