Skip to content

Commit 58a4def

Browse files
authored
Update _socket and socket for 3.14 (#14055)
1 parent fc1ee8f commit 58a4def

File tree

5 files changed

+61
-38
lines changed

5 files changed

+61
-38
lines changed

stdlib/@tests/stubtest_allowlists/linux-py314.txt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@
44

55
_curses.assume_default_colors
66
_posixsubprocess.fork_exec
7-
_socket.CAN_RAW_ERR_FILTER
8-
_socket.IPV6_RECVERR
9-
_socket.IP_FREEBIND
10-
_socket.IP_RECVERR
11-
_socket.IP_RECVORIGDSTADDR
12-
_socket.SO_ORIGINAL_DST
13-
_socket.VMADDR_CID_LOCAL
147
asyncio.tools
158
asyncio.unix_events.__all__
169
asyncio.unix_events.DefaultEventLoopPolicy
@@ -22,10 +15,3 @@ errno.EHWPOISON
2215
multiprocessing.popen_fork.Popen.interrupt
2316
multiprocessing.reduction.ACKNOWLEDGE
2417
select.EPOLLWAKEUP
25-
socket.CAN_RAW_ERR_FILTER
26-
socket.IPV6_RECVERR
27-
socket.IP_FREEBIND
28-
socket.IP_RECVERR
29-
socket.IP_RECVORIGDSTADDR
30-
socket.SO_ORIGINAL_DST
31-
socket.VMADDR_CID_LOCAL

stdlib/@tests/stubtest_allowlists/py314.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ _heapq.heappush_max
1111
_heapq.heappushpop_max
1212
_heapq.heapreplace_max
1313
_imp.pyc_magic_number_token
14-
_socket.IP_RECVTTL
15-
_socket.if_indextoname
1614
_thread.RLock.locked
1715
_thread.set_name
1816
asyncio.__all__
@@ -95,9 +93,6 @@ pkgutil.find_loader
9593
pkgutil.get_loader
9694
pyexpat.errors.XML_ERROR_NOT_STARTED
9795
shutil.__all__
98-
socket.__all__
99-
socket.IP_RECVTTL
100-
socket.if_indextoname
10196
sre_compile.CH_NEGATE
10297
sre_constants.CH_NEGATE
10398
sre_parse.CH_NEGATE

stdlib/@tests/stubtest_allowlists/win32-py314.txt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22
# TODO: New errors in Python 3.14 that need to be fixed or moved below
33
# ====================================================================
44

5-
_socket.IPV6_RECVERR
6-
_socket.IP_RECVERR
7-
_socket.SOL_RFCOMM
8-
_socket.SO_ORIGINAL_DST
9-
_socket.SO_BTH_ENCRYPT
10-
_socket.SO_BTH_MTU
11-
_socket.SO_BTH_MTU_MAX
12-
_socket.SO_BTH_MTU_MIN
13-
_socket.TCP_QUICKACK
145
_winapi.COPY_FILE_DIRECTORY
156
asyncio.WindowsProactorEventLoopPolicy.get_child_watcher
167
asyncio.WindowsProactorEventLoopPolicy.set_child_watcher
@@ -31,15 +22,6 @@ encodings.win32_code_page_search_function
3122
nt.readinto
3223
pathlib.Path.group
3324
pathlib.Path.owner
34-
socket.IPV6_RECVERR
35-
socket.IP_RECVERR
36-
socket.SOL_RFCOMM
37-
socket.SO_ORIGINAL_DST
38-
socket.SO_BTH_ENCRYPT
39-
socket.SO_BTH_MTU
40-
socket.SO_BTH_MTU_MAX
41-
socket.SO_BTH_MTU_MIN
42-
socket.TCP_QUICKACK
4325
winsound.MB_ICONERROR
4426
winsound.MB_ICONINFORMATION
4527
winsound.MB_ICONSTOP

stdlib/_socket.pyi

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,28 @@ if sys.platform != "win32":
229229
IP_RECVOPTS: int
230230
IP_RECVRETOPTS: int
231231
IP_RETOPTS: int
232+
if sys.version_info >= (3, 14):
233+
IP_RECVTTL: int
234+
235+
if sys.platform == "win32" or sys.platform == "linux":
236+
IPV6_RECVERR: int
237+
IP_RECVERR: int
238+
SO_ORIGINAL_DST: int
239+
240+
if sys.platform == "win32":
241+
SOL_RFCOMM: int
242+
SO_BTH_ENCRYPT: int
243+
SO_BTH_MTU: int
244+
SO_BTH_MTU_MAX: int
245+
SO_BTH_MTU_MIN: int
246+
TCP_QUICKACK: int
247+
248+
if sys.platform == "linux":
249+
CAN_RAW_ERR_FILTER: int
250+
IP_FREEBIND: int
251+
IP_RECVORIGDSTADDR: int
252+
VMADDR_CID_LOCAL: int
253+
232254
if sys.platform != "win32" and sys.platform != "darwin":
233255
IP_TRANSPARENT: int
234256
if sys.platform != "win32" and sys.platform != "darwin" and sys.version_info >= (3, 11):
@@ -829,6 +851,11 @@ if sys.platform != "win32":
829851

830852
def if_nameindex() -> list[tuple[int, str]]: ...
831853
def if_nametoindex(oname: str, /) -> int: ...
832-
def if_indextoname(index: int, /) -> str: ...
854+
855+
if sys.version_info >= (3, 14):
856+
def if_indextoname(if_index: int, /) -> str: ...
857+
858+
else:
859+
def if_indextoname(index: int, /) -> str: ...
833860

834861
CAPI: CapsuleType

stdlib/socket.pyi

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,39 @@ if sys.platform != "linux":
10231023

10241024
__all__ += ["IPPROTO_GGP", "IPPROTO_IPV4", "IPPROTO_MAX", "IPPROTO_ND", "IP_RECVDSTADDR", "SO_USELOOPBACK"]
10251025

1026+
if sys.version_info >= (3, 14):
1027+
from _socket import IP_RECVTTL as IP_RECVTTL
1028+
1029+
__all__ += ["IP_RECVTTL"]
1030+
1031+
if sys.platform == "win32" or sys.platform == "linux":
1032+
from _socket import IP_RECVERR as IP_RECVERR, IPV6_RECVERR as IPV6_RECVERR, SO_ORIGINAL_DST as SO_ORIGINAL_DST
1033+
1034+
__all__ += ["IP_RECVERR", "IPV6_RECVERR", "SO_ORIGINAL_DST"]
1035+
1036+
if sys.platform == "win32":
1037+
from _socket import (
1038+
SO_BTH_ENCRYPT as SO_BTH_ENCRYPT,
1039+
SO_BTH_MTU as SO_BTH_MTU,
1040+
SO_BTH_MTU_MAX as SO_BTH_MTU_MAX,
1041+
SO_BTH_MTU_MIN as SO_BTH_MTU_MIN,
1042+
SOL_RFCOMM as SOL_RFCOMM,
1043+
TCP_QUICKACK as TCP_QUICKACK,
1044+
)
1045+
1046+
__all__ += ["SOL_RFCOMM", "SO_BTH_ENCRYPT", "SO_BTH_MTU", "SO_BTH_MTU_MAX", "SO_BTH_MTU_MIN", "TCP_QUICKACK"]
1047+
1048+
if sys.platform == "linux":
1049+
from _socket import (
1050+
CAN_RAW_ERR_FILTER as CAN_RAW_ERR_FILTER,
1051+
IP_FREEBIND as IP_FREEBIND,
1052+
IP_RECVORIGDSTADDR as IP_RECVORIGDSTADDR,
1053+
SO_ORIGINAL_DST as SO_ORIGINAL_DST,
1054+
VMADDR_CID_LOCAL as VMADDR_CID_LOCAL,
1055+
)
1056+
1057+
__all__ += ["CAN_RAW_ERR_FILTER", "IP_FREEBIND", "IP_RECVORIGDSTADDR", "VMADDR_CID_LOCAL"]
1058+
10261059
# Re-exported from errno
10271060
EBADF: int
10281061
EAGAIN: int

0 commit comments

Comments
 (0)