Skip to content

Commit 4ea1f95

Browse files
authored
Bump ctypes to 3.14 (#14137)
1 parent adabd34 commit 4ea1f95

8 files changed

Lines changed: 28 additions & 26 deletions

File tree

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
# ====================================================================
44

55
asyncio.tools
6-
ctypes.c_double_complex._type_
7-
ctypes.c_float_complex._type_
8-
ctypes.c_longdouble_complex._type_
96

107

118
# =======

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@
33
# ====================================================================
44

55
asyncio.tools
6-
ctypes.c_double_complex._type_
7-
ctypes.c_float_complex._type_
8-
ctypes.c_longdouble_complex._type_

stdlib/@tests/stubtest_allowlists/py314.txt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,6 @@ compression.gzip.GzipFile.readinto1
1616
compression.gzip.GzipFile.readinto1
1717
compression.gzip.compress
1818
compression.zstd
19-
ctypes.memoryview_at
20-
ctypes.py_object.__class_getitem__
21-
ctypes.util.dllist
22-
ctypes.wintypes.HCONV
23-
ctypes.wintypes.HCONVLIST
24-
ctypes.wintypes.HCURSOR
25-
ctypes.wintypes.HDDEDATA
26-
ctypes.wintypes.HDROP
27-
ctypes.wintypes.HFILE
28-
ctypes.wintypes.HRESULT
29-
ctypes.wintypes.HSZ
3019
fractions.Fraction.__pow__
3120
fractions.Fraction.__rpow__
3221
gzip.GzipFile.readinto

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

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

55
_winapi.COPY_FILE_DIRECTORY
66
compression.zlib.ZLIBNG_VERSION
7-
ctypes.c_double_complex
8-
ctypes.c_float_complex
9-
ctypes.c_longdouble_complex
107
encodings.win32_code_page_search_function
118
nt.readinto
129
pathlib.Path.group

stdlib/_ctypes.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ class _CData:
7575
_objects: Mapping[Any, int] | None
7676
def __buffer__(self, flags: int, /) -> memoryview: ...
7777
def __ctypes_from_outparam__(self, /) -> Self: ...
78+
if sys.version_info >= (3, 14):
79+
__pointer_type__: type
7880

7981
# this is a union of all the subclasses of _CData, which is useful because of
8082
# the methods that are present on each of those subclasses which are not present

stdlib/ctypes/__init__.pyi

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ from typing_extensions import Self, TypeAlias, deprecated
3131
if sys.platform == "win32":
3232
from _ctypes import FormatError as FormatError, get_last_error as get_last_error, set_last_error as set_last_error
3333

34+
if sys.version_info >= (3, 14):
35+
from _ctypes import COMError as COMError
36+
3437
if sys.version_info >= (3, 11):
3538
from ctypes._endian import BigEndianUnion as BigEndianUnion, LittleEndianUnion as LittleEndianUnion
3639

@@ -197,8 +200,13 @@ if sys.platform == "win32":
197200

198201
def wstring_at(ptr: _CVoidConstPLike, size: int = -1) -> str: ...
199202

203+
if sys.version_info >= (3, 14):
204+
def memoryview_at(ptr: _CVoidConstPLike, size: int, readonly: bool = False) -> memoryview: ...
205+
200206
class py_object(_CanCastTo, _SimpleCData[_T]):
201207
_type_: ClassVar[Literal["O"]]
208+
if sys.version_info >= (3, 14):
209+
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
202210

203211
class c_bool(_SimpleCData[bool]):
204212
_type_: ClassVar[Literal["?"]]
@@ -270,16 +278,16 @@ class c_double(_SimpleCData[float]):
270278
class c_longdouble(_SimpleCData[float]): # can be an alias for c_double
271279
_type_: ClassVar[Literal["d", "g"]]
272280

273-
if sys.version_info >= (3, 14):
274-
class c_float_complex(_SimpleCData[complex]):
275-
_type_: ClassVar[Literal["E"]]
276-
281+
if sys.version_info >= (3, 14) and sys.platform != "win32":
277282
class c_double_complex(_SimpleCData[complex]):
278-
_type_: ClassVar[Literal["C"]]
283+
_type_: ClassVar[Literal["D"]]
279284

280-
class c_longdouble_complex(_SimpleCData[complex]):
285+
class c_float_complex(_SimpleCData[complex]):
281286
_type_: ClassVar[Literal["F"]]
282287

288+
class c_longdouble_complex(_SimpleCData[complex]):
289+
_type_: ClassVar[Literal["G"]]
290+
283291
class c_char(_SimpleCData[bytes]):
284292
_type_: ClassVar[Literal["c"]]
285293
def __init__(self, value: int | bytes | bytearray = ...) -> None: ...

stdlib/ctypes/util.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@ def find_library(name: str) -> str | None: ...
55
if sys.platform == "win32":
66
def find_msvcrt() -> str | None: ...
77

8+
if sys.version_info >= (3, 14):
9+
def dllist() -> list[str]: ...
10+
811
def test() -> None: ...

stdlib/ctypes/wintypes.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ HACCEL = HANDLE
8383
HBITMAP = HANDLE
8484
HBRUSH = HANDLE
8585
HCOLORSPACE = HANDLE
86+
if sys.version_info >= (3, 14):
87+
HCONV = HANDLE
88+
HCONVLIST = HANDLE
89+
HCURSOR = HANDLE
90+
HDDEDATA = HANDLE
91+
HDROP = HANDLE
92+
HFILE = INT
93+
HRESULT = LONG
94+
HSZ = HANDLE
8695
HDC = HANDLE
8796
HDESK = HANDLE
8897
HDWP = HANDLE

0 commit comments

Comments
 (0)