Skip to content

gh-89977: Keep the GIL for short socket calls - #157981

Merged
methane merged 3 commits into
python:mainfrom
methane:codex/avoid-gil-release-socket-metadata
Oct 24, 2026
Merged

methane merged 3 commits into
python:mainfrom
methane:codex/avoid-gil-release-socket-metadata

Conversation

@methane

@methane methane commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Follow up on gh-89977 with a narrow set of normally short system calls:

Keep the GIL during socket setblocking(), getsockname(), getpeername(), and POSIX gethostname().

These calls are not guaranteed to complete immediately on every platform, but the usual short path avoids a GIL release and reacquisition that can cause a thread handoff under contention.

Prepared with AI assistance.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@methane methane changed the title gh-89977: Keep the GIL for short socket and epoll control calls gh-89977: Keep the GIL for short socket calls Sep 29, 2026
@methane
methane merged commit 94d16d2 into python:main Oct 24, 2026
54 checks passed
@methane
methane deleted the codex/avoid-gil-release-socket-metadata branch October 24, 2026 11:51
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.

2 participants