# HG changeset patch # User Manuel Jacob # Date 1653831801 -7200 # Node ID b6b6ae9ea91ea183a72ff1832b42f9e12e43a549 # Parent 7d9a45c7517f78a80b8a4291a5b7009478022b40 py3: remove dead code to make file descriptors non-inheritable On Python 3, file descriptors are already non-inheritable by default. diff -r 7d9a45c7517f -r b6b6ae9ea91e tests/test-stdio.py --- a/tests/test-stdio.py Sun May 29 15:53:01 2022 +0200 +++ b/tests/test-stdio.py Sun May 29 15:43:21 2022 +0200 @@ -16,25 +16,6 @@ from mercurial import pycompat, util -if pycompat.ispy3: - - def set_noninheritable(fd): - # On Python 3, file descriptors are non-inheritable by default. - pass - - -else: - if pycompat.iswindows: - # unused - set_noninheritable = None - else: - import fcntl - - def set_noninheritable(fd): - old = fcntl.fcntl(fd, fcntl.F_GETFD) - fcntl.fcntl(fd, fcntl.F_SETFD, old | fcntl.FD_CLOEXEC) - - TEST_BUFFERING_CHILD_SCRIPT = r''' import os @@ -127,10 +108,6 @@ @contextlib.contextmanager def _pipes(): rwpair = os.pipe() - # Pipes are already non-inheritable on Windows. - if not pycompat.iswindows: - set_noninheritable(rwpair[0]) - set_noninheritable(rwpair[1]) with _closing(rwpair): yield rwpair @@ -143,8 +120,6 @@ import tty rwpair = pty.openpty() - set_noninheritable(rwpair[0]) - set_noninheritable(rwpair[1]) with _closing(rwpair): tty.setraw(rwpair[0]) yield rwpair