Skip to content

Commit d01b90c

Browse files
gh-154227: Fix os.posix_openpt() on OpenBSD (GH-154228)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 051b6e0 commit d01b90c

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9186,7 +9186,9 @@ os_posix_openpt_impl(PyObject *module, int oflag)
91869186
{
91879187
int fd;
91889188

9189-
#if defined(O_CLOEXEC)
9189+
// 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__)
91909192
oflag |= O_CLOEXEC;
91919193
#endif
91929194

0 commit comments

Comments
 (0)