Message263760
> Hmm, if `sys.__stdout__` was deleted (or set to `None`), this would also raise an `AttributeError` when calling `shutil.get_terminal_size`, so I think that even if `os.get_terminal_size` is guaranteed to be always present (which it's not, IIUC), catching `AttributeError` would prevent that bug, too.
It would be nice to have an unit test too for this case. You can use something like:
with unittest.mock.patch('shutil.sys') as mock_sys:
del mock_sys.__stdout__
print(shutil.get_terminal_size((3, 3)))
(and mock also os.envion, as shown in the review.) |
|
Date |
User |
Action |
Args |
2016-04-19 19:39:08 | vstinner | set | recipients:
+ vstinner, martin.panter, serhiy.storchaka, abarry |
2016-04-19 19:39:08 | vstinner | set | messageid: <1461094748.33.0.716684245783.issue26801@psf.upfronthosting.co.za> |
2016-04-19 19:39:08 | vstinner | link | issue26801 messages |
2016-04-19 19:39:08 | vstinner | create | |
|