This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: should pty.openpty() set pty/tty inheritable?
Type: Stage:
Components: IO Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: cagney, hugh, twouters
Priority: normal Keywords:

Created on 2019-04-11 15:17 by cagney, last changed 2022-04-11 14:59 by admin.

Messages (1)
msg339982 - (view) Author: cagney (cagney) Date: 2019-04-11 15:17
pty.openpty(), on systems with a working os.openpty() / openpty(3) executes:

    if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0)
        goto posix_error;
    if (_Py_set_inheritable(master_fd, 0, NULL) < 0)
        goto error;
    if (_Py_set_inheritable(slave_fd, 0, NULL) < 0)
        goto error;

where as on systems where this is fails it instead executes:

    master_fd, slave_name = _open_terminal()
    slave_fd = slave_open(slave_name)
        i.e., result = os.open(tty_name, os.O_RDWR)
    return master_fd, slave_fd

where os.open() was "Changed in version 3.4: The new file descriptor is now non-inheritable."

(personally I'd deprecate pty.openpty(), but that is just me)
History
Date User Action Args
2022-04-11 14:59:13adminsetgithub: 80784
2019-04-11 16:20:58hughsetnosy: + hugh
2019-04-11 15:26:13SilentGhostsetnosy: + twouters
2019-04-11 15:17:03cagneycreate