From 17a109fdbf272899fcfd3232b65d445cc1cf14d6 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 22 Jul 2026 08:26:08 +0300 Subject: [PATCH] [3.13] gh-154416: Fix hanging test_tcflow on DragonFly BSD (GH-154417) TCIOFF and TCION transmit STOP and START characters, and closing the pseudo-terminal waits until they are read. Discard them. (cherry picked from commit b0c945a27e708419c6845234ef633ce3f7c4c41e) Co-authored-by: Serhiy Storchaka Co-Authored-By: Claude Opus 4.8 --- Lib/test/test_termios.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/test_termios.py b/Lib/test/test_termios.py index cbc922bb3e31ca..91c92c3f2e6ec2 100644 --- a/Lib/test/test_termios.py +++ b/Lib/test/test_termios.py @@ -169,6 +169,9 @@ def test_tcflow(self): termios.tcflow(self.fd, termios.TCOON) termios.tcflow(self.fd, termios.TCIOFF) termios.tcflow(self.fd, termios.TCION) + # Discard the transmitted STOP and START characters, + # otherwise closing the pseudo-terminal can block. + termios.tcflush(self.fd, termios.TCOFLUSH) def test_tcflow_errors(self): self.assertRaisesTermiosError(errno.EINVAL, termios.tcflow, self.fd, -1)