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

Add missing ETH_P_ALL identifier to socket #11876

Merged
merged 1 commit into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions stdlib/socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,13 @@ if sys.version_info >= (3, 12):
ETHERTYPE_VLAN as ETHERTYPE_VLAN,
)

if sys.platform == "linux":
from _socket import ETH_P_ALL as ETH_P_ALL

if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
# FreeBSD >= 14.0
from _socket import PF_DIVERT as PF_DIVERT

# Re-exported from errno
EBADF: int
EAGAIN: int
Expand Down Expand Up @@ -525,6 +532,9 @@ class AddressFamily(IntEnum):
AF_BLUETOOTH = 32
if sys.platform == "win32" and sys.version_info >= (3, 12):
AF_HYPERV = 34
if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 12):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If preferred, can also do this as

if sys.version_info >= (3, 12):
    if sys.platform == "win32":
        AF_HYPERV = 34
    if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin":
        # FreeBSD >= 14.0
        AF_DIVERT = 44

# FreeBSD >= 14.0
AF_DIVERT = 44

AF_INET = AddressFamily.AF_INET
AF_INET6 = AddressFamily.AF_INET6
Expand Down Expand Up @@ -577,6 +587,9 @@ if sys.platform != "win32" or sys.version_info >= (3, 9):

if sys.platform == "win32" and sys.version_info >= (3, 12):
AF_HYPERV = AddressFamily.AF_HYPERV
if sys.platform != "linux" and sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 12):
# FreeBSD >= 14.0
AF_DIVERT = AddressFamily.AF_DIVERT

class SocketKind(IntEnum):
SOCK_STREAM = 1
Expand Down