summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-04-19 22:29:11 +0200
committerVictor Stinner <victor.stinner@gmail.com>2016-04-19 22:29:11 +0200
commit5bfe0da80840bf6a0edcf7be2482ac584125ede1 (patch)
treee9d7b6f6003f251e318e10170f22882d68c614f9 /Lib
parent0fea25af4805ba132c0af2720dcf87c53ad43fdf (diff)
parent119ebb70e9b7ae15896ced52321d626b757e7cbb (diff)
downloadcpython-git-5bfe0da80840bf6a0edcf7be2482ac584125ede1.tar.gz
Merge 3.5: issue #26801
Diffstat (limited to 'Lib')
-rw-r--r--Lib/shutil.py2
-rw-r--r--Lib/test/test_shutil.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/Lib/shutil.py b/Lib/shutil.py
index f47a763f35..ca6c47f08d 100644
--- a/Lib/shutil.py
+++ b/Lib/shutil.py
@@ -1072,7 +1072,7 @@ def get_terminal_size(fallback=(80, 24)):
if columns <= 0 or lines <= 0:
try:
size = os.get_terminal_size(sys.__stdout__.fileno())
- except (NameError, OSError):
+ except (AttributeError, OSError):
size = os.terminal_size(fallback)
if columns <= 0:
columns = size.columns
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py
index ca1d006763..7e41891e5e 100644
--- a/Lib/test/test_shutil.py
+++ b/Lib/test/test_shutil.py
@@ -1837,6 +1837,8 @@ class TermsizeTests(unittest.TestCase):
self.assertEqual(size.lines, 888)
@unittest.skipUnless(os.isatty(sys.__stdout__.fileno()), "not on tty")
+ @unittest.skipUnless(hasattr(os, 'get_terminal_size'),
+ 'need os.get_terminal_size()')
def test_stty_match(self):
"""Check if stty returns the same results ignoring env