]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-154416: Fix hanging test_tcflow on DragonFly BSD (GH-154417) (GH-154421)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 22 Jul 2026 05:47:25 +0000 (08:47 +0300)
committerGitHub <noreply@github.com>
Wed, 22 Jul 2026 05:47:25 +0000 (05:47 +0000)
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: Claude Opus 4.8 <noreply@anthropic.com>
Lib/test/test_termios.py

index aa562b25cbcd3e58b249d07204655124a2b1f695..ca9d2afb76dbec21df54e5a1a79df1d58bc8a456 100644 (file)
@@ -169,6 +169,9 @@ class TestFunctions(unittest.TestCase):
         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)