From 43ad3b51707f51ae4b434e2b5950d2c8bf7cca6e Mon Sep 17 00:00:00 2001 From: Cody Maloney Date: Tue, 8 Oct 2024 04:49:50 -0700 Subject: gh-90102: Fix pyio _isatty_open_only() (#125089) Spotted by @ngnpope. `isatty` returns False to indicate the file is not a TTY. The C implementation of _io does that (`Py_RETURN_FALSE`) but I got the bool backwards in the _pyio implementaiton. --- Lib/_pyio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 2a1d2a3..7b6d10c 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -1806,7 +1806,7 @@ class FileIO(RawIOBase): """ if (self._stat_atopen is not None and not stat.S_ISCHR(self._stat_atopen.st_mode)): - return True + return False return os.isatty(self._fd) @property -- cgit v0.12