Make `os.get_terminal_size` check `isatty` before calling `ioctl` (#1… · python/cpython@51ae3c0 · GitHub
Skip to content

Commit 51ae3c0

Browse files
authored
Make os.get_terminal_size check isatty before calling ioctl (#154885)
Calling ioctl on stdout raises warnings on Android. Ensure we have a TTY before doing terminal size calls.
1 parent 49f9667 commit 51ae3c0

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

Lib/test/test_os/test_os.py

Lines changed: 1 addition & 6 deletions
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:func:`os.get_terminal_size` now checks ``isatty`` before calling ``ioctl``,
2+
which reduces log noise on Android.

Modules/posixmodule.c

Lines changed: 7 additions & 0 deletions

0 commit comments

Comments
 (0)