Prior to being able to call `isatty()` or `ttyname()` on a new subsidiary pty, the "ptem" module must be pushed there. diff -wpruN --no-dereference '--exclude=*.orig' a~/Lib/test/test_os.py a/Lib/test/test_os.py --- a~/Lib/test/test_os.py 1970-01-01 00:00:00 +++ a/Lib/test/test_os.py 1970-01-01 00:00:00 @@ -4719,6 +4719,7 @@ class PseudoterminalTests(unittest.TestC son_path = os.ptsname(mother_fd) son_fd = os.open(son_path, os.O_RDWR|os.O_NOCTTY) self.addCleanup(os.close, son_fd) + fcntl.ioctl(son_fd, fcntl.I_PUSH, "ptem") self.assertEqual(os.ptsname(mother_fd), os.ttyname(son_fd)) @unittest.skipUnless(hasattr(os, 'spawnl'), "need os.spawnl()")