Skip to content

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

Open
methane wants to merge 3 commits into
python:mainfrom
methane:codex/avoid-gil-release-socket-metadata
Open

methane wants to merge 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 commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

@codex review

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants