Skip to content

gh-159561: Remove redundant type check in AF_VSOCK setsockopt() - #159610

Merged
benjaminp merged 2 commits into
python:mainfrom
lazerg:fix-issue-159561
Oct 18, 2026
Merged

benjaminp merged 2 commits into
python:mainfrom
lazerg:fix-issue-159561

Conversation

@lazerg

@lazerg lazerg commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

The AF_VSOCK branch of sock_setsockopt() set a TypeError for a non-int option value but kept going, so PyArg_Parse() ran with an exception already pending. The check is redundant since the K converter already rejects non-int values, so I removed it.

Fixes #159561

@benjaminp benjaminp 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.

Does it work to delete this whole block? PyArg_Parse will validate.

@lazerg lazerg changed the title gh-159561: Return early on non-int optval in AF_VSOCK setsockopt() gh-159561: Remove redundant type check in AF_VSOCK setsockopt() Oct 18, 2026
@lazerg

lazerg commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

Yes, it works. The K converter does its own index check and raises a TypeError, so I removed the block in 2b7ac5a.

@benjaminp
benjaminp enabled auto-merge (squash) October 18, 2026 04:08
@benjaminp
benjaminp merged commit 03a3f3d into python:main Oct 18, 2026
59 checks passed
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.

useless AF_VSOCK setsockopt validation code

2 participants