Skip to content

gh-160368: Detect sem_clockwait at runtime on Linux - #160371

Merged
itamaro merged 1 commit into
python:mainfrom
zanieb:pbs/sem-clockwait-upstream
Oct 23, 2026
Merged

itamaro merged 1 commit into
python:mainfrom
zanieb:pbs/sem-clockwait-upstream

Conversation

@zanieb

@zanieb zanieb commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

When Python is built with older Linux libc headers, timed semaphore waits use the real-time clock even if sem_clockwait is available at runtime. Use a weak reference on supported compilers to select sem_clockwait at runtime, falling back to sem_timedwait when the symbol is absent. ThreadSanitizer builds continue to use the real-time clock.

Addresses astral-sh/python-build-standalone#1176.

Closes #160368.

@itamaro itamaro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@itamaro
itamaro enabled auto-merge (squash) October 22, 2026 22:44
@itamaro
itamaro merged commit badd5d5 into python:main Oct 23, 2026
62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Check sem_clockwait availability at runtime on Linux

2 participants