Bug report
os.posix_openpt() is unusable on OpenBSD — every call fails:
>>> os.posix_openpt(os.O_RDWR | os.O_NOCTTY)
OSError: [Errno 22] Invalid argument
Modules/posixmodule.c unconditionally adds O_CLOEXEC to the flags, but OpenBSD's posix_openpt(3) returns EINVAL for any flag other than O_RDWR and O_NOCTTY. The function already makes the fd non-inheritable with _Py_set_inheritable() immediately afterwards, so skip the O_CLOEXEC flag on OpenBSD.