changeset: 101067:75f40345d784 parent: 101065:ac78c0bc2c3e parent: 101066:e3763b5964b6 user: Victor Stinner date: Tue Apr 19 22:29:11 2016 +0200 files: Lib/shutil.py Misc/ACKS Misc/NEWS description: Merge 3.5: issue #26801 diff -r ac78c0bc2c3e -r 75f40345d784 Lib/shutil.py --- a/Lib/shutil.py Tue Apr 19 21:50:40 2016 +0200 +++ b/Lib/shutil.py Tue Apr 19 22:29:11 2016 +0200 @@ -1072,7 +1072,7 @@ 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 -r ac78c0bc2c3e -r 75f40345d784 Lib/test/test_shutil.py --- a/Lib/test/test_shutil.py Tue Apr 19 21:50:40 2016 +0200 +++ b/Lib/test/test_shutil.py Tue Apr 19 22:29:11 2016 +0200 @@ -1837,6 +1837,8 @@ 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 diff -r ac78c0bc2c3e -r 75f40345d784 Misc/ACKS --- a/Misc/ACKS Tue Apr 19 21:50:40 2016 +0200 +++ b/Misc/ACKS Tue Apr 19 22:29:11 2016 +0200 @@ -90,6 +90,7 @@ Richard Barran Cesar Eduardo Barros Des Barry +Emanuel Barry Ulf Bartelt Campbell Barton Don Bashford diff -r ac78c0bc2c3e -r 75f40345d784 Misc/NEWS --- a/Misc/NEWS Tue Apr 19 21:50:40 2016 +0200 +++ b/Misc/NEWS Tue Apr 19 22:29:11 2016 +0200 @@ -245,6 +245,10 @@ Library ------- +- Issue #26801: Fix error handling in :func:`shutil.get_terminal_size`, catch + :exc:`AttributeError` instead of :exc:`NameError`. Patch written by Emanuel + Barry. + - Issue #24838: tarfile's ustar and gnu formats now correctly calculate name and link field limits for multibyte character encodings like utf-8.