Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
A5rocks opened this issue Dec 24, 2024 · 5 comments
Closed
Labels
extension-modules C modules in the Modules dir OS-mac type-bug An unexpected behavior, bug, or error

Comments

@A5rocks
Copy link

A5rocks commented Dec 24, 2024

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

@A5rocks A5rocks added the type-bug An unexpected behavior, bug, or error label Dec 24, 2024
@A5rocks A5rocks changed the title Strange regression between 3.13.0 and 3.13.1 Strange regression between 3.13.0 and 3.13.1 with socket.socket#setsockopt Dec 24, 2024
@A5rocks
Copy link
Author

A5rocks commented Dec 24, 2024

My hypothesis is that this is a build-time difference (ie the Python distributed by the setup-python GitHub Action is built without access to this constant for their 3.13.1 build but had it in their 3.13.0 build), but I don't have anything to prove or disprove that.

@picnixz picnixz added OS-mac extension-modules C modules in the Modules dir labels Dec 24, 2024
@picnixz
Copy link
Contributor

picnixz commented Dec 24, 2024

Tagging it as a macOS issue for now (I'm not on my dev session to confirm if this is also a linux issue)

@ronaldoussoren
Copy link
Contributor

FWIW, this code works for me on macOS 15.2 laptop using Python 3.13.1 (Python.org installer).

Note that socket.SO_BINDTODEVICE is available on macOS because the constant is available in the system headers (at least in the macOS 15.2 SDK, but not in the 14.5 SDK).

Which macOS runner do you use?

Github's documentation lists a number of runners using older versions of macOS (and it seems that macOS-latest is still macOS 14 at this point in time).

@A5rocks
Copy link
Author

A5rocks commented Dec 24, 2024

I believe we use macos 14 runners

Here is a sample failure: https://github.com/A5rocks/trio/actions/runs/12475578169/job/34819176988

... another hypothesis: the constant isn't available on 3.13.0 and we skipped the test and I didn't notice. I'll check when I'm at a computer.

@A5rocks
Copy link
Author

A5rocks commented Dec 24, 2024

Ok, so turns out the issue was that 3.13.1 has the symbol and 3.13.0 does not (presumably because 3.13.0 was built on macos 14?), so our tests try running this (which fails because at runtime it's macos 14).

I should have tested the minimized version against 3.13.0 instead of just confirming it still errored on 3.13.1. Sorry for the spurious bug report.

@A5rocks A5rocks closed this as not planned Won't fix, can't repro, duplicate, stale Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir OS-mac type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants