New submission from Florian Bruhin <python....@the-compiler.org>:

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

----------
components: Library (Lib)
messages: 379773
nosy: The Compiler, giampaolo.rodola, tarek
priority: normal
severity: normal
status: open
title: shutil.get_terminal_size() returns 0 when run in a pty
type: behavior
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42174>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to