diff --git a/stdlib/@tests/stubtest_allowlists/linux-py314.txt b/stdlib/@tests/stubtest_allowlists/linux-py314.txt index 091e7257d..8611de3f9 100644 --- a/stdlib/@tests/stubtest_allowlists/linux-py314.txt +++ b/stdlib/@tests/stubtest_allowlists/linux-py314.txt @@ -4,13 +4,6 @@ _curses.assume_default_colors _posixsubprocess.fork_exec -_socket.CAN_RAW_ERR_FILTER -_socket.IPV6_RECVERR -_socket.IP_FREEBIND -_socket.IP_RECVERR -_socket.IP_RECVORIGDSTADDR -_socket.SO_ORIGINAL_DST -_socket.VMADDR_CID_LOCAL asyncio.tools asyncio.unix_events.__all__ asyncio.unix_events.DefaultEventLoopPolicy @@ -22,10 +15,3 @@ errno.EHWPOISON multiprocessing.popen_fork.Popen.interrupt multiprocessing.reduction.ACKNOWLEDGE select.EPOLLWAKEUP -socket.CAN_RAW_ERR_FILTER -socket.IPV6_RECVERR -socket.IP_FREEBIND -socket.IP_RECVERR -socket.IP_RECVORIGDSTADDR -socket.SO_ORIGINAL_DST -socket.VMADDR_CID_LOCAL diff --git a/stdlib/@tests/stubtest_allowlists/py314.txt b/stdlib/@tests/stubtest_allowlists/py314.txt index 93c3fd384..476713f10 100644 --- a/stdlib/@tests/stubtest_allowlists/py314.txt +++ b/stdlib/@tests/stubtest_allowlists/py314.txt @@ -11,8 +11,6 @@ _heapq.heappush_max _heapq.heappushpop_max _heapq.heapreplace_max _imp.pyc_magic_number_token -_socket.IP_RECVTTL -_socket.if_indextoname _thread.RLock.locked _thread.set_name asyncio.__all__ @@ -95,9 +93,6 @@ pkgutil.find_loader pkgutil.get_loader pyexpat.errors.XML_ERROR_NOT_STARTED shutil.__all__ -socket.__all__ -socket.IP_RECVTTL -socket.if_indextoname sre_compile.CH_NEGATE sre_constants.CH_NEGATE sre_parse.CH_NEGATE diff --git a/stdlib/@tests/stubtest_allowlists/win32-py314.txt b/stdlib/@tests/stubtest_allowlists/win32-py314.txt index cf30f5056..2da868653 100644 --- a/stdlib/@tests/stubtest_allowlists/win32-py314.txt +++ b/stdlib/@tests/stubtest_allowlists/win32-py314.txt @@ -2,15 +2,6 @@ # TODO: New errors in Python 3.14 that need to be fixed or moved below # ==================================================================== -_socket.IPV6_RECVERR -_socket.IP_RECVERR -_socket.SOL_RFCOMM -_socket.SO_ORIGINAL_DST -_socket.SO_BTH_ENCRYPT -_socket.SO_BTH_MTU -_socket.SO_BTH_MTU_MAX -_socket.SO_BTH_MTU_MIN -_socket.TCP_QUICKACK _winapi.COPY_FILE_DIRECTORY asyncio.WindowsProactorEventLoopPolicy.get_child_watcher asyncio.WindowsProactorEventLoopPolicy.set_child_watcher @@ -31,15 +22,6 @@ encodings.win32_code_page_search_function nt.readinto pathlib.Path.group pathlib.Path.owner -socket.IPV6_RECVERR -socket.IP_RECVERR -socket.SOL_RFCOMM -socket.SO_ORIGINAL_DST -socket.SO_BTH_ENCRYPT -socket.SO_BTH_MTU -socket.SO_BTH_MTU_MAX -socket.SO_BTH_MTU_MIN -socket.TCP_QUICKACK winsound.MB_ICONERROR winsound.MB_ICONINFORMATION winsound.MB_ICONSTOP diff --git a/stdlib/_socket.pyi b/stdlib/_socket.pyi index 5399f4edf..06a8a2ba5 100644 --- a/stdlib/_socket.pyi +++ b/stdlib/_socket.pyi @@ -229,6 +229,28 @@ if sys.platform != "win32": IP_RECVOPTS: int IP_RECVRETOPTS: int IP_RETOPTS: int +if sys.version_info >= (3, 14): + IP_RECVTTL: int + + if sys.platform == "win32" or sys.platform == "linux": + IPV6_RECVERR: int + IP_RECVERR: int + SO_ORIGINAL_DST: int + + if sys.platform == "win32": + SOL_RFCOMM: int + SO_BTH_ENCRYPT: int + SO_BTH_MTU: int + SO_BTH_MTU_MAX: int + SO_BTH_MTU_MIN: int + TCP_QUICKACK: int + + if sys.platform == "linux": + CAN_RAW_ERR_FILTER: int + IP_FREEBIND: int + IP_RECVORIGDSTADDR: int + VMADDR_CID_LOCAL: int + if sys.platform != "win32" and sys.platform != "darwin": IP_TRANSPARENT: int if sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 11): @@ -829,6 +851,11 @@ if sys.platform != "win32": def if_nameindex() -> list[tuple[int, str]]: ... def if_nametoindex(oname: str, /) -> int: ... -def if_indextoname(index: int, /) -> str: ... + +if sys.version_info >= (3, 14): + def if_indextoname(if_index: int, /) -> str: ... + +else: + def if_indextoname(index: int, /) -> str: ... CAPI: CapsuleType diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index ff89dcc72..1ee006235 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -1023,6 +1023,39 @@ if sys.platform != "linux": __all__ += ["IPPROTO_GGP", "IPPROTO_IPV4", "IPPROTO_MAX", "IPPROTO_ND", "IP_RECVDSTADDR", "SO_USELOOPBACK"] +if sys.version_info >= (3, 14): + from _socket import IP_RECVTTL as IP_RECVTTL + + __all__ += ["IP_RECVTTL"] + + if sys.platform == "win32" or sys.platform == "linux": + from _socket import IP_RECVERR as IP_RECVERR, IPV6_RECVERR as IPV6_RECVERR, SO_ORIGINAL_DST as SO_ORIGINAL_DST + + __all__ += ["IP_RECVERR", "IPV6_RECVERR", "SO_ORIGINAL_DST"] + + if sys.platform == "win32": + from _socket import ( + SO_BTH_ENCRYPT as SO_BTH_ENCRYPT, + SO_BTH_MTU as SO_BTH_MTU, + SO_BTH_MTU_MAX as SO_BTH_MTU_MAX, + SO_BTH_MTU_MIN as SO_BTH_MTU_MIN, + SOL_RFCOMM as SOL_RFCOMM, + TCP_QUICKACK as TCP_QUICKACK, + ) + + __all__ += ["SOL_RFCOMM", "SO_BTH_ENCRYPT", "SO_BTH_MTU", "SO_BTH_MTU_MAX", "SO_BTH_MTU_MIN", "TCP_QUICKACK"] + + if sys.platform == "linux": + from _socket import ( + CAN_RAW_ERR_FILTER as CAN_RAW_ERR_FILTER, + IP_FREEBIND as IP_FREEBIND, + IP_RECVORIGDSTADDR as IP_RECVORIGDSTADDR, + SO_ORIGINAL_DST as SO_ORIGINAL_DST, + VMADDR_CID_LOCAL as VMADDR_CID_LOCAL, + ) + + __all__ += ["CAN_RAW_ERR_FILTER", "IP_FREEBIND", "IP_RECVORIGDSTADDR", "VMADDR_CID_LOCAL"] + # Re-exported from errno EBADF: int EAGAIN: int