Bug report
Bug description:
A read1 of 'stdin' in cbreak mode returns 0x0D (instead of 0x0A) when <enter> is entered.
That is for Python version 3.12.1, version 3.11.6 returns 0x0A.
The following code demonstrates this. When run enter <enter>.
"""cbreak <enter> test"""importsysimportttyimportselectimporttermiosfromtimeimportsleep# save stdin attributesprevStdinAttributes=termios.tcgetattr(sys.stdin)
# set cbreak mode:# "Enter cbreak mode. In cbreak mode (sometimes called “rare” mode) normal tty line buffering# is turned off and characters are available to be read one by one. However, unlike raw mode,# special characters (interrupt, quit, suspend, and flow control) retain their effects on the# tty driver and calling program. Calling first raw() then cbreak() leaves the terminal in cbreak mode."tty.setcbreak(sys.stdin, when=termios.TCSANOW)
c=b''# wait for a bytewhileTrue:
ifselect.select([sys.stdin], [], [], 0) == ([sys.stdin], [], []):
c=sys.stdin.buffer.read1(1)
breaksleep(.1)
# restore stdin attributestermios.tcsetattr(sys.stdin, termios.TCSADRAIN, prevStdinAttributes)
# print result byte in hexprint(f"bytes: '\\x{c.hex().upper()}'")CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux, macOS
Linked PRs
Bug report
Bug description:
A read1 of 'stdin' in cbreak mode returns 0x0D (instead of 0x0A) when <enter> is entered.
That is for Python version 3.12.1, version 3.11.6 returns 0x0A.
The following code demonstrates this. When run enter <enter>.
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux, macOS
Linked PRs