File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -470,11 +470,18 @@ def setsockopt_tests(sock: SocketType | SocketStream) -> None:
470470 try :
471471 sock .setsockopt (tsocket .SOL_SOCKET , tsocket .SO_BINDTODEVICE , None , 0 )
472472 except OSError as e :
473- # some versions of Python have the attribute yet can run on platforms
474- # that do not support it. For instance, MacOS 15 gained support for
475- # SO_BINDTODEVICE and CPython 3.13.1 was built on it (presumably), but
476- # our CI runners ran MacOS 14 and so failed.
477- assert e .errno == 42 # noqa: PT017
473+ assert e .errno in [ # noqa: PT017
474+ # some versions of Python have the attribute yet can run on
475+ # platforms that do not support it. For instance, MacOS 15
476+ # gained support for SO_BINDTODEVICE and CPython 3.13.1 was
477+ # built on it (presumably), but our CI runners ran MacOS 14 and
478+ # so failed.
479+ 42 ,
480+ # Older Linux kernels (prior to patch
481+ # https://lore.kernel.org/netdev/m37drhs1jn.fsf@bernat.ch/t/)
482+ # do not support SO_BINDTODEVICE as an unprivileged user.
483+ errno .EPERM ,
484+ ]
478485
479486 # specifying value
480487 sock .setsockopt (tsocket .IPPROTO_TCP , tsocket .TCP_NODELAY , False )
You can’t perform that action at this time.
0 commit comments