There was an error while loading. Please reload this page.
1 parent 051b6e0 commit d01b90cCopy full SHA for d01b90c
2 files changed
Misc/NEWS.d/next/Library/2026-07-20-14-00-00.gh-issue-154227.openpt.rst
@@ -0,0 +1,2 @@
1
+Fix :func:`os.posix_openpt` on OpenBSD, where it rejected the
2
+:data:`~os.O_CLOEXEC` flag.
Modules/posixmodule.c
@@ -9186,7 +9186,9 @@ os_posix_openpt_impl(PyObject *module, int oflag)
9186
{
9187
int fd;
9188
9189
-#if defined(O_CLOEXEC)
+ // OpenBSD posix_openpt() rejects any flag other than O_RDWR and
9190
+ // O_NOCTTY; the fd is made non-inheritable below in any case.
9191
+#if defined(O_CLOEXEC) && !defined(__OpenBSD__)
9192
oflag |= O_CLOEXEC;
9193
#endif
9194
0 commit comments