Open
Description
Bug report
Bug description:
Running python REPL under another program (strace ./build/python
in my case), then pressing Ctrl-C on Linux results in an infinite stream of exception tracebacks.
Tested on Python 3.13 branch and main
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/readline.py", line 394, in multiline_input return reader.readline() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 742, in readline self.prepare() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/historical_reader.py", line 306, in prepare super().prepare() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 594, in prepare self.restore() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 608, in restore self.console.restore() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 371, in restore tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/reader.py", line 585, in prepare self.console.prepare() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 339, in prepare tcsetattr(self.input_fd, termios.TCSADRAIN, raw) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/readline.py", line 394, in multiline_input return reader.readline() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 742, in readline self.prepare() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/historical_reader.py", line 306, in prepare super().prepare() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 594, in prepare self.restore() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 608, in restore self.console.restore() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 371, in restore tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/reader.py", line 585, in prepare self.console.prepare() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 339, in prepare tcsetattr(self.input_fd, termios.TCSADRAIN, raw) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/readline.py", line 394, in multiline_input return reader.readline() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 742, in readline self.prepare() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/historical_reader.py", line 306, in prepare super().prepare() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 594, in prepare self.restore() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 608, in restore self.console.restore() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 371, in restore tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/reader.py", line 585, in prepare self.console.prepare() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 339, in prepare tcsetattr(self.input_fd, termios.TCSADRAIN, raw) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/readline.py", line 394, in multiline_input return reader.readline() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 742, in readline self.prepare() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/historical_reader.py", line 306, in prepare super().prepare() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 594, in prepare self.restore() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 608, in restore self.console.restore() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 371, in restore tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/reader.py", line 585, in prepare self.console.prepare() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 339, in prepare tcsetattr(self.input_fd, termios.TCSADRAIN, raw) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/readline.py", line 394, in multiline_input return reader.readline() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 742, in readline self.prepare() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/historical_reader.py", line 306, in prepare super().prepare() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 594, in prepare self.restore() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 608, in restore self.console.restore() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 371, in restore tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/reader.py", line 585, in prepare self.console.prepare() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 339, in prepare tcsetattr(self.input_fd, termios.TCSADRAIN, raw) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/readline.py", line 394, in multiline_input return reader.readline() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 742, in readline self.prepare() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/historical_reader.py", line 306, in prepare super().prepare() ~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 594, in prepare self.restore() ~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/reader.py", line 608, in restore self.console.restore() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 371, in restore tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error') Traceback (most recent call last): File "/build/python/cpython/Lib/_pyrepl/reader.py", line 585, in prepare self.console.prepare() ~~~~~~~~~~~~~~~~~~~~^^ File "/build/python/cpython/Lib/_pyrepl/unix_console.py", line 339, in prepare tcsetattr(self.input_fd, termios.TCSADRAIN, raw) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/build/python/cpython/Lib/_pyrepl/fancy_termios.py", line 57, in tcsetattr termios.tcsetattr(fd, when, attrs.as_list()) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ termios.error: (5, 'Input/output error')
CPython versions tested on:
3.13
Operating systems tested on:
Linux