Skip to content

Check sem_clockwait availability at runtime on Linux #160368

Closed

Description

@zanieb

Bug report

A Linux Python built against older libc headers doesn't use sem_clockwait, even when the runtime libc provides it. The configure-time result means that binary keeps using realtime deadlines through sem_timedwait on newer systems.

In python-build-standalone, we build against an older libc baseline for portability. I'd like to upstream the runtime check tracked in astral-sh/python-build-standalone#1176, so timed semaphore waits can use CLOCK_MONOTONIC when sem_clockwait is available.

A weak reference would let supported Linux builds use the function when present and fall back to sem_timedwait otherwise. ThreadSanitizer builds would keep their realtime path.

This extends python/cpython#85876, which added the configure-time check.

CPython versions tested on:

3.15

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Oct 22, 2026
  2. self-assigned this
    on Oct 22, 2026
  3. added a commit that references this issue on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

extension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions