]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-154226: Fix test_posix_pty_functions on Solaris (GH-154230)
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 20 Jul 2026 08:51:10 +0000 (11:51 +0300)
committerGitHub <noreply@github.com>
Mon, 20 Jul 2026 08:51:10 +0000 (08:51 +0000)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Lib/test/test_os/test_os.py

index 5c258ff89ba735cd3d5474ce6161af92641ca5eb..41928b308c477992349374126d10f2a35ae49074 100644 (file)
@@ -4727,6 +4727,13 @@ class PseudoterminalTests(unittest.TestCase):
         son_path = os.ptsname(mother_fd)
         son_fd = os.open(son_path, os.O_RDWR|os.O_NOCTTY)
         self.addCleanup(os.close, son_fd)
+        if sys.platform.startswith('sunos'):
+            # The slave is not a terminal until these STREAMS modules
+            # are pushed onto it.
+            import fcntl
+            I_PUSH = 0x5302
+            fcntl.ioctl(son_fd, I_PUSH, b'ptem\0')
+            fcntl.ioctl(son_fd, I_PUSH, b'ldterm\0')
         self.assertEqual(os.ptsname(mother_fd), os.ttyname(son_fd))
 
     @warnings_helper.ignore_fork_in_thread_deprecation_warnings()