Author The Compiler
Recipients The Compiler, giampaolo.rodola, tarek
Date 2020-10-27.16:32:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When shutil.get_terminal_size() is used in a PTY, the os.get_terminal_size() call can return (0, 0).

With the pty script from

$ python3 python3 -c 'import shutil; print(shutil.get_terminal_size())'        
os.terminal_size(columns=0, lines=0)

While the following cases *are* handled by returning the fallback:

- COLUMNS or lines being non-existent or 0
- os.get_terminal_size raising

The case of os.get_terminal_size() succeeding but returning (0, 0) should probably be handled the same way as well.

This e.g. affects mypy when run with pre-commit:
Date User Action Args
2020-10-27 16:32:31The Compilersetrecipients: + The Compiler, giampaolo.rodola, tarek
2020-10-27 16:32:31The Compilersetmessageid: <>
2020-10-27 16:32:31The Compilerlinkissue42174 messages
2020-10-27 16:32:30The Compilercreate