Skip to content

Strange regression between 3.13.0 and 3.13.1 with socket.socket#setsockopt #128210

@A5rocks

Description

@A5rocks

Bug report

Bug description:

def test_regular_socket() -> None:
    stdlib_sock = stdlib_socket.socket()
    with stdlib_sock as _:
        stdlib_sock.setsockopt(
            stdlib_socket.SOL_SOCKET,
            stdlib_socket.SO_BINDTODEVICE,
            None,
            0,
        )

This fails on 3.13.1 at least on MacOS GitHub Actions runners, and succeeds on 3.13.0. I don't have a MacOS machine to bisect with.

Looking at this more after the fact, SO_BINDTODEVICE is Linux-specific so it's not surprising that it fails. The only surprise is that this used to work and now does not. I couldn't find anything in the detailed changelog about this but I wasn't sure the right keywords to use.

Here's the error:

  _____________________________ test_regular_socket ______________________________
  
      def test_regular_socket() -> None:
          stdlib_sock = stdlib_socket.socket()
          with stdlib_sock as _:
  >           stdlib_sock.setsockopt(
                  stdlib_socket.SOL_SOCKET,
                  stdlib_socket.SO_BINDTODEVICE,
                  None,
                  0,
              )
  E           OSError: [Errno 42] Protocol not available

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macextension-modulesC modules in the Modules dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions