https://github.com/python/cpython/commit/43ad3b51707f51ae4b434e2b5950d2c8bf7cca6e
commit: 43ad3b51707f51ae4b434e2b5950d2c8bf7cca6e
branch: main
author: Cody Maloney <[email protected]>
committer: vstinner <[email protected]>
date: 2024-10-08T11:49:50Z
summary:
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.
files:
M Lib/_pyio.py
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 2a1d2a33d02960..7b6d10c008d3cb 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -1806,7 +1806,7 @@ def _isatty_open_only(self):
"""
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
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]