diff options
author | Victor Stinner <vstinner@python.org> | 2024-01-10 22:02:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-10 22:02:17 (GMT) |
commit | 1d75fa43a25e5f3c33f2aaaec28fab9430834792 (patch) | |
tree | 34dba2c198c8befda9867702567f12876907922a /Modules/_io | |
parent | e82b096335dcf31aedd2d265cbcc2f87ad971bfe (diff) | |
download | cpython-1d75fa43a25e5f3c33f2aaaec28fab9430834792.zip cpython-1d75fa43a25e5f3c33f2aaaec28fab9430834792.tar.gz cpython-1d75fa43a25e5f3c33f2aaaec28fab9430834792.tar.bz2 |
gh-77046: os.pipe() sets _O_NOINHERIT flag on fds (#113817)
On Windows, set _O_NOINHERIT flag on file descriptors
created by os.pipe() and io.WindowsConsoleIO.
Add test_pipe_spawnl() to test_os.
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Diffstat (limited to 'Modules/_io')
-rw-r--r-- | Modules/_io/winconsoleio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_io/winconsoleio.c b/Modules/_io/winconsoleio.c index fecb338..54e1555 100644 --- a/Modules/_io/winconsoleio.c +++ b/Modules/_io/winconsoleio.c @@ -391,9 +391,9 @@ _io__WindowsConsoleIO___init___impl(winconsoleio *self, PyObject *nameobj, } if (self->writable) - self->fd = _Py_open_osfhandle_noraise(handle, _O_WRONLY | _O_BINARY); + self->fd = _Py_open_osfhandle_noraise(handle, _O_WRONLY | _O_BINARY | _O_NOINHERIT); else - self->fd = _Py_open_osfhandle_noraise(handle, _O_RDONLY | _O_BINARY); + self->fd = _Py_open_osfhandle_noraise(handle, _O_RDONLY | _O_BINARY | _O_NOINHERIT); if (self->fd < 0) { PyErr_SetFromErrnoWithFilenameObject(PyExc_OSError, nameobj); CloseHandle(handle); |