socket: consistency between constants and enums (#8099)

This matches what happens at runtime, from Enum._convert_
Helps with #8098. Closes #5696.
This commit is contained in:
Shantanu
2022-06-19 00:57:55 -07:00
committed by GitHub
parent 64181e8dad
commit b7f8d847be
9 changed files with 33 additions and 32 deletions

View File

@@ -390,39 +390,43 @@ class AddressFamily(IntEnum):
AF_INET: int
AF_INET6: int
AF_AAL5: int
AF_ALG: int
AF_APPLETALK: int
AF_ASH: int
AF_ATMPVC: int
AF_ATMSVC: int
AF_AX25: int
AF_BLUETOOTH: int
AF_BRIDGE: int
AF_CAN: int
AF_DECnet: int
AF_ECONET: int
AF_IPX: int
AF_IRDA: int
AF_KEY: int
AF_LINK: int
AF_LLC: int
AF_NETBEUI: int
AF_NETLINK: int
AF_NETROM: int
AF_PACKET: int
AF_PPPOX: int
AF_QIPCRTR: int
AF_RDS: int
AF_ROSE: int
AF_ROUTE: int
AF_SECURITY: int
AF_SNA: int
AF_SYSTEM: int
AF_TIPC: int
AF_UNSPEC: int
AF_VSOCK: int
AF_WANPIPE: int
AF_X25: int
if sys.platform == "linux":
AF_CAN: int
AF_PACKET: int
AF_RDS: int
AF_TIPC: int
AF_ALG: int
AF_NETLINK: int
if sys.version_info >= (3, 7):
AF_VSOCK: int
if sys.version_info >= (3, 8):
AF_QIPCRTR: int
AF_LINK: AddressFamily # availability: BSD, macOS
if sys.platform != "darwin":
AF_BLUETOOTH: int
AF_UNIX: AddressFamily
AF_INET: AddressFamily
@@ -463,7 +467,7 @@ if sys.platform == "linux":
if sys.version_info >= (3, 8):
AF_QIPCRTR: AddressFamily
AF_LINK: AddressFamily # availability: BSD, macOS
if sys.platform != "win32" and sys.platform != "darwin":
if sys.platform != "darwin":
AF_BLUETOOTH: AddressFamily
class SocketKind(IntEnum):
@@ -472,8 +476,9 @@ class SocketKind(IntEnum):
SOCK_RAW: int
SOCK_RDM: int
SOCK_SEQPACKET: int
SOCK_CLOEXEC: int
SOCK_NONBLOCK: int
if sys.platform == "linux":
SOCK_CLOEXEC: int
SOCK_NONBLOCK: int
SOCK_STREAM: SocketKind
SOCK_DGRAM: SocketKind
@@ -485,10 +490,22 @@ if sys.platform == "linux":
SOCK_NONBLOCK: SocketKind
class MsgFlag(IntFlag):
MSG_BCAST: int
MSG_BTAG: int
MSG_CMSG_CLOEXEC: int
MSG_CONFIRM: int
MSG_CTRUNC: int
MSG_DONTROUTE: int
MSG_DONTWAIT: int
MSG_EOF: int
MSG_EOR: int
MSG_ERRQUEUE: int
MSG_ETAG: int
MSG_FASTOPEN: int
MSG_MCAST: int
MSG_MORE: int
MSG_NOSIGNAL: int
MSG_NOTIFICATION: int
MSG_OOB: int
MSG_PEEK: int
MSG_TRUNC: int
@@ -519,10 +536,13 @@ class AddressInfo(IntFlag):
AI_ADDRCONFIG: int
AI_ALL: int
AI_CANONNAME: int
AI_DEFAULT: int
AI_MASK: int
AI_NUMERICHOST: int
AI_NUMERICSERV: int
AI_PASSIVE: int
AI_V4MAPPED: int
AI_V4MAPPED_CFG: int
AI_ADDRCONFIG: AddressInfo
AI_ALL: AddressInfo

View File

@@ -16,10 +16,6 @@ distutils.msvccompiler.MSVCCompiler.set_path_env_var
distutils.msvccompiler.MacroExpander
mimetypes.MimeTypes.read_windows_registry
selectors.DefaultSelector.fileno
socket.AddressInfo.AI_DEFAULT
socket.AddressInfo.AI_MASK
socket.AddressInfo.AI_V4MAPPED_CFG
socket.MsgFlag.MSG_EOF
posix.NGROUPS_MAX
posix.error.characters_written

View File

@@ -17,12 +17,6 @@ distutils.msvccompiler.MSVCCompiler.set_path_env_var
distutils.msvccompiler.MacroExpander
mimetypes.MimeTypes.read_windows_registry
selectors.DefaultSelector.fileno
socket.MsgFlag.MSG_CMSG_CLOEXEC
socket.MsgFlag.MSG_CONFIRM
socket.MsgFlag.MSG_ERRQUEUE
socket.MsgFlag.MSG_FASTOPEN
socket.MsgFlag.MSG_MORE
socket.MsgFlag.MSG_NOSIGNAL
spwd.struct_spwd.sp_nam
spwd.struct_spwd.sp_pwd

View File

@@ -9,7 +9,6 @@ asyncio.windows_events.IocpProactor.recvfrom
asyncio.windows_events.IocpProactor.sendto
distutils.command.build_ext.__warningregistry__
msvcrt.GetErrorMode
socket.MsgFlag.MSG_ERRQUEUE
subprocess.STARTUPINFO.copy
# ==========

View File

@@ -12,7 +12,6 @@ asyncio.windows_events.IocpProactor.sendto
distutils.command.build_ext.__warningregistry__
msvcrt.GetErrorMode
os.EX_OK
socket.MsgFlag.MSG_ERRQUEUE
subprocess.STARTUPINFO.copy
# ==========

View File

@@ -10,9 +10,6 @@ urllib.parse.parse_qsl
os.startfile
# Exists at runtime, but missing from stubs
socket.MsgFlag.MSG_ERRQUEUE
# ==========
# Allowlist entries that cannot or should not be fixed
# ==========

View File

@@ -7,7 +7,6 @@ asyncio.IocpProactor.recvfrom
asyncio.IocpProactor.sendto
asyncio.windows_events.IocpProactor.recvfrom
asyncio.windows_events.IocpProactor.sendto
socket.MsgFlag.MSG_ERRQUEUE
subprocess.STARTUPINFO.copy
# ==========

View File

@@ -7,7 +7,6 @@ asyncio.IocpProactor.recvfrom
asyncio.IocpProactor.sendto
asyncio.windows_events.IocpProactor.recvfrom
asyncio.windows_events.IocpProactor.sendto
socket.MsgFlag.MSG_ERRQUEUE
subprocess.STARTUPINFO.copy
# ==========

View File

@@ -27,8 +27,6 @@ distutils.msvccompiler.MSVCCompiler.manifest_get_embed_info
distutils.msvccompiler.MSVCCompiler.manifest_setup_ldargs
distutils.msvccompiler.OldMSVCCompiler
msvcrt.SetErrorMode
socket.MsgFlag.MSG_BCAST
socket.MsgFlag.MSG_MCAST
ssl.SSLSocket.recvmsg
ssl.SSLSocket.recvmsg_into
ssl.SSLSocket.sendmsg