Skip to content

useless AF_VSOCK setsockopt validation code #159561

Description

@benjaminp

Consider:

cpython/Modules/socketmodule.c

Lines 3423 to 3427 in d3ada45

if (!PyIndex_Check(optval)) {
PyErr_Format(PyExc_TypeError,
"setsockopt() argument 3 for AF_VSOCK must be an int (got %T)",
optval);
}

This sets an error, but doesn't return, so the code falls through to parsing optval anyway.

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    topic-socketRelated to the socket, socketserver and selectors modules
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extension-modulesC modules in the Modules dirtopic-socketRelated to the socket, socketserver and selectors modulestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions