Skip to content

os.posix_openpt() always fails with EINVAL on OpenBSD #154227

Closed

Description

@serhiy-storchaka

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.

Linked PRs

Activity

  1. added
    type-bug
    extension-modules
    3.13
    3.14
    3.15
    3.16
    on Jul 20, 2026
  2. added a commit that references this issue on Jul 20, 2026
  3. added 3 commits that reference this issue on Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.133.143.153.16OS-unsupportedextension-modulestype-bug

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions