From 46bb26439a7629d070927dfedb6af792b50bb8dc Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Thu, 5 Dec 2024 22:46:07 -0800 Subject: [PATCH 1/2] ctypes.CDLL._func_restype_ is a type, not an instance --- stdlib/ctypes/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index 3e0e7c45bf15..d9ead3521b8d 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -47,7 +47,7 @@ class ArgumentError(Exception): ... class CDLL: _func_flags_: ClassVar[int] - _func_restype_: ClassVar[_CDataType] + _func_restype_: ClassVar[type[_CDataType]] _name: str _handle: int _FuncPtr: type[_FuncPointer] From 13be46ea2c3cd0c55a052dfada8b250061e232dd Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Thu, 5 Dec 2024 22:49:28 -0800 Subject: [PATCH 2/2] expand the options for c_time_t --- stdlib/ctypes/__init__.pyi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index d9ead3521b8d..a15dd3615c0c 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -202,7 +202,10 @@ if sys.platform == "win32": class HRESULT(_SimpleCData[int]): ... # TODO undocumented if sys.version_info >= (3, 12): - c_time_t: type[c_int32 | c_int64] # alias for one or the other at runtime + # At runtime, this is an alias for either c_int32 or c_int64, + # which are themselves an alias for one of c_short, c_int, c_long, or c_longlong + # This covers all our bases. + c_time_t: type[c_int32 | c_int64 | c_short | c_int | c_long | c_longlong] class py_object(_CanCastTo, _SimpleCData[_T]): ...