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 <1603816351.29.0.440046743483.issue42174@roundup.psfhosted.org>
In-reply-to
Content
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 https://github.com/python/mypy/issues/8144#issue-537760245:

$ python3 t.py 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:
https://github.com/pre-commit/mirrors-mypy/issues/29
History
Date User Action Args
2020-10-27 16:32:31The Compilersetrecipients: + The Compiler, giampaolo.rodola, tarek
2020-10-27 16:32:31The Compilersetmessageid: <1603816351.29.0.440046743483.issue42174@roundup.psfhosted.org>
2020-10-27 16:32:31The Compilerlinkissue42174 messages
2020-10-27 16:32:30The Compilercreate