summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2024-01-21 23:25:52 (GMT)
committerGitHub <noreply@github.com>2024-01-21 23:25:52 (GMT)
commitfd49e226700e2483a452c3c92da6f15d822ae054 (patch)
treee7077e2bd31e3e365ece2657e1265adbfca47e6e /Doc
parentdb1c18eb6220653290a3ba9ebbe1df44394a3f19 (diff)
downloadcpython-fd49e226700e2483a452c3c92da6f15d822ae054.zip
cpython-fd49e226700e2483a452c3c92da6f15d822ae054.tar.gz
cpython-fd49e226700e2483a452c3c92da6f15d822ae054.tar.bz2
gh-114328: tty cbreak mode should not alter ICRNL (#114335)
The terminal CR -> NL mapping setting should be inherited in cbreak mode as OSes do not specify altering it as part of their stty cbreak mode definition.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/tty.rst15
1 files changed, 15 insertions, 0 deletions
diff --git a/Doc/library/tty.rst b/Doc/library/tty.rst
index 20ba7d7..ed63561 100644
--- a/Doc/library/tty.rst
+++ b/Doc/library/tty.rst
@@ -35,8 +35,15 @@ The :mod:`tty` module defines the following functions:
Convert the tty attribute list *mode*, which is a list like the one returned
by :func:`termios.tcgetattr`, to that of a tty in cbreak mode.
+ This clears the ``ECHO`` and ``ICANON`` local mode flags in *mode* as well
+ as setting the minimum input to 1 byte with no delay.
+
.. versionadded:: 3.12
+ .. versionchanged:: 3.12.2
+ The ``ICRNL`` flag is no longer cleared. This matches Linux and macOS
+ ``stty cbreak`` behavior and what :func:`setcbreak` historically did.
+
.. function:: setraw(fd, when=termios.TCSAFLUSH)
@@ -56,9 +63,17 @@ The :mod:`tty` module defines the following functions:
:func:`termios.tcsetattr`. The return value of :func:`termios.tcgetattr`
is saved before setting *fd* to cbreak mode; this value is returned.
+ This clears the ``ECHO`` and ``ICANON`` local mode flags as well as setting
+ the minimum input to 1 byte with no delay.
+
.. versionchanged:: 3.12
The return value is now the original tty attributes, instead of None.
+ .. versionchanged:: 3.12.2
+ The ``ICRNL`` flag is no longer cleared. This restores the behavior
+ of Python 3.11 and earlier as well as matching what Linux, macOS, & BSDs
+ describe in their ``stty(1)`` man pages regarding cbreak mode.
+
.. seealso::