Skip to content

Commit 5ff6b9b

Browse files
committed
fix: address comments
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
1 parent 9235522 commit 5ff6b9b

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

Lib/_pyrepl/unix_console.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,13 +339,11 @@ def prepare(self):
339339
try:
340340
tcsetattr(self.input_fd, termios.TCSADRAIN, raw)
341341
except termios.error as e:
342-
if e.args[0] == errno.EIO:
342+
if e.args[0] != errno.EIO:
343343
# gh-135329
344344
# When running under external programs (like strace),
345345
# tcsetattr may fail with EIO. We can safely ignore this
346346
# and continue with default terminal settings.
347-
pass
348-
else:
349347
raise
350348

351349
# In macOS terminal we need to deactivate line wrap via ANSI escape code
@@ -381,13 +379,11 @@ def restore(self):
381379
try:
382380
tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate)
383381
except termios.error as e:
384-
if e.args[0] == errno.EIO:
382+
if e.args[0] != errno.EIO:
385383
# gh-135329
386384
# When running under external programs (like strace),
387385
# tcsetattr may fail with EIO. We can safely ignore this
388-
# as the terminal state will be restored by the external program.
389-
pass
390-
else:
386+
# and continue with default terminal settings.
391387
raise
392388

393389
if platform.system() == "Darwin" and os.getenv("TERM_PROGRAM") == "Apple_Terminal":
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
prevent infinite traceback loop on Ctrl-C for strace
1+
Prevent infinite traceback loop when sending CTRL^C to Python through ``strace``.

0 commit comments

Comments
 (0)