From: Cody Maloney Date: Tue, 8 Oct 2024 11:49:50 +0000 (-0700) Subject: gh-90102: Fix pyio _isatty_open_only() (#125089) X-Git-Tag: v3.14.0a1~147 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=43ad3b51707f51ae4b434e2b5950d2c8bf7cca6e;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 2a1d2a33d029..7b6d10c008d3 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