From 119ebb70e9b7ae15896ced52321d626b757e7cbb Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 19 Apr 2016 22:24:56 +0200 Subject: Fix shutil.get_terminal_size() error handling Issue #26801: Fix error handling in shutil.get_terminal_size(), catch AttributeError instead of NameError. Patch written by Emanuel Barry. test_shutil: skip the functional test using "stty size" command if os.get_terminal_size() is missing. --- Lib/shutil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/shutil.py') diff --git a/Lib/shutil.py b/Lib/shutil.py index 3f4b6bf663..7f8edf5e5a 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -1069,7 +1069,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 -- cgit v1.2.1